My goal is to write a zsh
script in order to create multiple screen
sessions and run separate commands on each of them. I would also like to check at the beginning of my script if there are any screens with running jobs and terminate all of them that sit idle. Furthermore, if possible I would like to have a way to record the stdout of the individual screen and get their ID number. So far I have tried the following:
### Script for running everything in screens ###
killall -15 screen ## We make sure that no screens are running for now
#bkg_array = ("TopJets" "BosonJets" "DiBoson" "TTbar")
screen -dmS "MYSCREEN"
screen -S "MYSCREEN" -p 0 -X stuff 'echo "The array has of elements."\n'
However, I cannot seem to send the keystroke for pressing Enter
; how can I achieve that effect? Additionally without the -p
option the command is not sent to the screen. After pressing Ctrl+V+Enter the characters ^M
were pasted on the screen and it pressed enter in the screen session, but I have no idea why that worked.
Thanks for your help, feel free to point out any ambiguities.
tmux
tmux
is not installed on the machine I am running the shell script on and I have no administrator privileges on the computer.tmux
and forgetscreen
. Just usezpty
. Youll automatically get that array you want. Combine that withztcp
and youve got remote access.man zsh-modules
for information on both. Else, look here for a simple-mindedzpty
demo.