bash bleg

Jan. 23rd, 2007 12:39 pm
gusl: (Default)
[personal profile] gusl
My bash interpreter has been acting funny, in such a way that I've been needing to translate all (carriage returns) to ";" in my scripts, in such a way that the script becomes one huge line.

If I don't do this editing, I get the following problems:
* for each empty line in a script, I get a : command not found error.
* if I don't end the script with ";", I get syntax error: unexpected end of file.
* for an rm command like rm C:/Documents and Settings/Administrator/filename, I get the error:
rm: cannot remove `C:/Documents and Settings/Administrator/filename\r': No such file or directory

This seems to suggest that bash is reading my carriage returns as "\r". (However, running a script with only "echo " prints empty line, whereas "echo \r" prints "r")

Any ideas?

(no subject)

Date: 2007-01-23 07:56 pm (UTC)
From: [identity profile] gwillen.livejournal.com
Bash is indeed reading your carriage returns as \r. Echo \r prints r because what you're actually doing is "echo r" -- the shell is removing the backslash. Did you write the shellscript on a mac or something?

(no subject)

Date: 2007-01-23 08:45 pm (UTC)
From: (Anonymous)
No. The shell-scripts have always worked before.

I am currently *unable* to write scripts that have carriage returns in them.

(no subject)

Date: 2007-01-23 08:46 pm (UTC)
From: [identity profile] gustavolacerda.livejournal.com
That was me.

(no subject)

Date: 2007-01-23 08:53 pm (UTC)
From: [identity profile] gustavolacerda.livejournal.com
To put it more generally, I am unable to correctly run any script that has a carriage return in it.

February 2020

S M T W T F S
      1
2345678
9101112131415
16171819202122
23242526272829

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags