I am trying to run a command in screen mode using the command
screen -dmS screen_name sed -i 's/a/b/'g some-file.txt
Nothing happens. When I put the same command in a script and run the command:
screen -dmS screen_name bash -c /path/to/script
It works.
My question is, can I run a command in daemon mode without first having to put it in a script?
Basically, I need this daemon feature because it helps in running several commands in parallel, by running several sed commands on large files in parallel by throwing each command on a separate screen daemon, which terminates automatically after the program finishes.
Thanks
Best Answer
I guess the issue is with the -S if you try to omit the -S option, it should ,work, even without bash -c so try this
That should work. BTW screen is not updated, you should consider switching to tmux. It can provide you with much more features.
You can install tmux by typing:
So your code should look like:
I could test it with
if you type
It will take you to a session with top. Hope that this helps. check
for all features and check here for a comprehensive cheat sheet