[Ilugc] What is wrong in this script ?

  • From: linux-lug@xxxxxxxxxxx (Subba Rao)
  • Date: Thu, 28 Jul 2011 20:44:33 +0200

In VI, you could also try,

:%s/^V^M//g

which will remove the ^M characters.   The ^M character is the "Return" key on 
the keyboard.  Obviously there is a hidden ^M character.

Let us know if this fixed your problem.

Subbarao

http://investeur.co/

-----Original Message-----
From: Mukesh Yadav [mailto:mak.gnu@xxxxxxxxx] ;
Sent: Thursday, July 28, 2011 5:40 PM
To: ILUG-C
Subject: Re: [Ilugc] What is wrong in this script ?



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
_______________________________________________
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc


Other related posts: