I want to run a bash script in a detached screen. The script calls a program a few times, each of which takes too long to wait. My first thought was to simply open a screen and then call the script, but it appears that I can't detach (by
ctrl-a d) while the script is running. So I did some research and found this instruction to replace the shebang with following:
#!/usr/bin/screen -d -m -S screenName /bin/bash
But that doesn't work, either (the options are not recognized). Any suggestions?
PS It occurs to me just now that
screen -dmS name ./script.sh would probably work for my purposes, but I'm still curious about how to incorporate this into the script. Thank you.