Reputation: 23178
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 option m
Why does this work in the command line but not as a shell script?
Upvotes: 1
Views: 429
Reputation: 23178
This file was transferred from windows and had ctrl-M characters.
Upvotes: 3
Reputation: 38195
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 ?).
Upvotes: 0
Reputation: 8716
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.
Upvotes: 1