0

I did this:

ssh -f user@host "screen -dm -S screenName"

Now I want to add a bash script command to this line so that the command is executed then the screen detaches.

edit:

so I want to do so

ssh -f user@host "screen -dm -S screenName bash bashing.sh"

bashing.sh:

#!/bin/bash
echo "testing it";

but actually nothing happens when I run the command over ssh.

Even when I just from the server run this command only screen -dm -S screenName bash bashing.sh.

edit 1:

I tried everything so far in the answers and comments and even in the suggested question as duplicate but nothing works for me, so any help would be still very appreciated.

Sincerely

1 Answers1

1
ssh -f user@host "screen -dm -S screenName sleep 123"
Hauke Laging
  • 90,279
  • That kills the screen after the sleep time is done

    I want to run a command and keep the screen alive just detach from it

    – Omar K. Aly Mar 28 '18 at 12:01
  • 1
    ssh -f user@host "screen -dm -S screenName myscript" where myscript does something like sleep 123; bash. – NickD Mar 28 '18 at 13:15
  • @Nick actually my script should do this ====> #!/bin/bash echo "testing it"; ==== And instead of myscript I just used my script name ===> "bashing.sh" .... is that right ? – Omar K. Aly Mar 28 '18 at 13:25