开发者

Simple shell script doesn't work like command line?

I'm trying to write a script that contains this

screen -S demo -d -m which should start a new screen session named demo and detach it. Putting screen -S demo -d -m in the command line works.

If I put it in a file named boot.sh, and run it ./boot.sh I get

Error: Unknown o开发者_如何学Goption m Why does this work in the command line but not as a shell script?


This file was transferred from windows and had ctrl-M characters.


Running "screen" on my Linux machine, a bad option (Screen version 4.00.03jw4 (FAU) 2-May-06) gives the error,

Error: Unknown option -z"

while your description includes no dash before the offending option. I'd check that the characters in your script file are what you expect them to be. There are many characters that look like a dash but which are not.

cat -v boot.sh

may show something interesting as it'll show codes for non-ascii characters.


This may seem a little like the "make sure your printer is plugged in" kind of help, but anyway:

have you tried to check if the screen you're invoking from the script is the same as the one invoked from the command line ?

I'm thinking you may change the PATH variable inside your script somewhere and perhaps screen from the script would be something else (a different version, perhaps ?).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜