I’m trying to start daemon screens with screen -dmS nameofscreen command. This works by itself, but when I use a command with && or | it seems to interpret it wrong.
Example: screen -dmS screen1 echo test && ls -al
It seems to be interpreted as (screen -dmS screen1 echo test) && (ls -al) and I’m looking for it to be interpreted as screen -dmS screen1 (echo test && ls -al).
How is this done? If I use () around the commands to be passed, screen doesn’t accept it?
Parentheses and
&&and||are interpreted by the shell, not by screen. To get those operators to work in screen you need an explicit sub-shell.