[KLUG Programming] Re: [KLUG Members] getting exit code in bash script

bill bill at billtron.com
Fri Mar 11 14:33:04 EST 2005


On Fri, 2005-03-11 at 13:32, Bruce Smith wrote:
> I copied/pasted your lines into a script on my SuSE 9.2 box and it runs
> fine for me.

> Maybe you have some unprintable character in your script or something?

I copied/pasted your lines into a script on my Linux box and another
SuSE 9.2 box and both reported the same error.  The only thing I changed
was I replaced "somecommand" with "ls"...

> Try putting the text from the second echo in double quotes, 

did that

> or send your
> script to me privately as an _attachment_.

O.K., I found it.  

Before the "ls" command I had used a tab in gedit.  Apparently, gedit
puts in some odd characters.  Here's how I found it.

Editing the script in vi didn't show it.

So, I changed the shebang to 

#!/bin/bash -x

and I started getting this line:

+ $'\302\240\302\240\302\240\302\240\302\240' ls


Once I removed the whitespace before ls and replaced it with spaces, it
worked.

Any idea what the '\302\240' means and how to detect it in a script?





More information about the Programming mailing list