As well, I recommend that you put each statement on it's own line. Some of these lines are lengthy, and you're confusing things by using semicolons to delimit statements. That code, even in code tags is needlessly difficult to read. I can see at least two such cases where it causes an error because you escape the semicolon as required by find -exec, but then fail to add a semicolon to separate it from the next statement. I can say that's the most likely reason you're getting
Code:
1-update-pot-files.sh: line 20: syntax error near unexpected token `do'
1-update-pot-files.sh: line 20: `find themes/common/ -iname "*.php" -exec xgettext -L PHP --omit-header --no-location --sort-output --from-code=utf-8 -j -o language/messages.pot {} \;for i in `cat /tmp/.lang_folders` ; do mkdir -p "$i/language" ; done'
change this line, adding the semicolon denoted in red:
Code:
find themes/common/ -iname "*.php" -exec xgettext -L PHP --omit-header --no-location --sort-output --from-code=utf-8 -j -o language/messages.pot {} \; ; for i in `cat /tmp/.lang_folders` ; do mkdir -p "$i/language" ; done
Whitespace and comments are your friends.
Get rid of the backticks. You did it right with
CWD=$(pwd). Do the same everywhere. On that note, use pushd and popd, let bash do the work of storing the previous directory for you.