2

What is the meaning of "-s" in the following command?

ssh [email protected] /bin/bash -s << EOT

(from https://forum.gitlab.com/t/better-way-for-multiline-ssh-command/23420)

I understand that the command open a SSH session and execute /bin/bash with/followed_by the "-s" argument/option.
Is this correct?

Furthermore, I think it says "execute the following script and it "pass << EOT" to say get all the following text/lines as the script code, it will end with an "EOT".
If the previous interpretation is correct EOT is End Of Transmission and can be any word (is just a label)?

3
  • When you ask for "meaning of" a command/a switch/etc. give a manual read with command man ..., that's in your case man bash
    – mattia.b89
    May 2, 2020 at 19:15
  • Sorry, I did but still was not clear to me and other documentation online just refer to "-" or "-i", plus with my question I wanted to know a little bit more. (also, initially I thought -s was an argument for ssh :-()
    – Alex 75
    May 2, 2020 at 19:56
  • Also this information was important. Just share with us next time, so we (I) can better answer
    – mattia.b89
    May 2, 2020 at 20:52

1 Answer 1

4

The -s option of a standard compliant shell tells the shell to read commands from stdin even if stdin is not connected to a tty.

In your case, the here document that follows in the script is used as stdin for the shell and that input is used as script to execute.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .