Shell script suddenly not working
But today when i run it is giving these errors:
% sh minify.sh
: not found1: minify.sh:
: not found2: minify.sh:
minify.sh: 3: set: Illegal option -
When I removed the 3rd line again a new bunch of errors. Yesterday some sever problem was there as Mysql crashed twice. Mine is Ubuntu 12.04.4 LTS
Here is the script code:
set -x
tmp1=/tmp/__fdsfdsf11.js
tmp2=/tmp/__fdsfdsf22.js
rm -f $tmp1 $tmp2 /tmp/vars.log /tmp/funcs.log
bankstr=""
files="$bankstr myscript.js options.js user-selections.js background.js common.js client_server_common.js injected/remove-alert.js"
for i in $files
do
cat $i| /home/ragu/railways/jsparser/collectSymbols> $tmp2
cat $i| php /home/ragu/railways/jsparser/find_patterns.php >> /tmp/funcs.log
if [ ! -f $i ]
then
echo "$i not found! ..."
exit 1
fi
done
for i in $files
do
cat $i| php /home/raggupta/railways/jsparser/replace.php> $tmp1
yui-compressor $tmp1 > $i
done
rm $tmp1
1 Reply
screwing things up
You can check this by running cat -v minify.sh - if you see "^M" at the end of each line, then that's the problem. It can be fixed with recode IBM-PC..latin1 minify.sh or sed -i 's/\r$//' minify.sh.