[Ilugc] What is wrong in this script ?

  • From: mak.gnu@xxxxxxxxx (Mukesh Yadav)
  • Date: Thu, 28 Jul 2011 21:09:49 +0530



There is a DOS/Windows line-ending character ^M at the end of the
shebang line. Can you remove it and try running the script again?
'dos2unix' utility can help you do that or you could do a global search
and replace in your favorite editor or use sed or whichever way is
convenient for you.


there is no ^M character in file I opened in vi editor and also in gedit,
Its only 6 lines of code.

when I try to run
$ sh yuicompress.sh

I get this error

$ yuicompress.sh: 3: Syntax error: word unexpected (expecting "do")

My code i.e. in yuicompress.sh

#!/bin/sh
for file in `find . -name "*.js"`
do
echo "Compressing $file ?"
java -jar ~/yuicompressor-2.4.6/build/yuicompressor-2.4.6.jar --type js -o
$file $file
done


-- 
Regards
Mukesh Yadav

Other related posts: