When a script that I started in a screen is finished can I tell it to close the current Screen it's in? If so how? I know I can do "ctrl + a" then k, then y. To kill it but Im not there to issue those buttons. And I tried adding "exit" to the end of the script which doesn't seem to close it ether.
I also have a script that will auto start another script in a screen, this seems to work, but Im not 100% sure that I got all the syntax right?
screen -dm -S "script0$scriptID"; sleep 1; screen -S "fscript0$scriptID" -X screen ./script.sh "$input1" "$input2"
Thanks any help.
Type 'quit' and Enter to leave the current screen session. Note that this will remove your screen session. Ctrl + A and then K will only kill the current window in the current session, not the whole session. A screen session consists of windows, which can be created using subsequent Ctrl + A followed by C .
Leaving Screen Terminal Session First, we are using “Ctrl-A” and “d” to detach the screen. Second, we can use the exit command to terminating the screen. You also can use “Ctrl-A” and “K” to kill the screen. That's some of the screen usages on daily basis.
One of the many known methods to exit a bash script while writing is the simple shortcut key, i.e., “Ctrl+X”. While at run time, you can exit the code using “Ctrl+Z”.
To end a shell script and set its exit status, use the exit command. Give exit the exit status that your script should have. If it has no explicit status, it will exit with the status of the last command run.
This command will cause the current session of screen
to quit:
screen -X quit
The syntax of the command in your second question looks OK to me. Can you be more specific about where you think there might be a problem?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With