Skip to main content
added 42 characters in body
Source Link
Chris Davies
  • 128k
  • 16
  • 178
  • 323

You're losing output because the quoting is wrong.

ssh [email protected] bash -l -c 'echo 111'

What you have here is a call to bash with a requirement to execute echo. The remaining argument 111 is offered to bash but unused. (The result is a blank line.)

What you probably want is one of the following alternatives.

ssh [email protected] 'echo 111'                 # Shell executing echo

ssh -t [email protected] 'echo 111'              # LoginInteractive shell (with `.bashrc`)  executing echo

ssh [email protected] 'bash -l -c "echo 111"'    # Shell calling login shell (`.bash_profile`) to execute echo

You're losing output because the quoting is wrong.

ssh [email protected] bash -l -c 'echo 111'

What you have here is a call to bash with a requirement to execute echo. The remaining argument 111 is offered to bash but unused. (The result is a blank line.)

What you probably want is one of the following alternatives.

ssh [email protected] 'echo 111'                 # Shell executing echo

ssh -t [email protected] 'echo 111'              # Login shell executing echo

ssh [email protected] 'bash -l -c "echo 111"'    # Shell calling login shell to execute echo

You're losing output because the quoting is wrong.

ssh [email protected] bash -l -c 'echo 111'

What you have here is a call to bash with a requirement to execute echo. The remaining argument 111 is offered to bash but unused. (The result is a blank line.)

What you probably want is one of the following alternatives.

ssh [email protected] 'echo 111'                 # Shell executing echo

ssh -t [email protected] 'echo 111'              # Interactive shell (with `.bashrc`)  executing echo

ssh [email protected] 'bash -l -c "echo 111"'    # Shell calling login shell (`.bash_profile`) to execute echo
Source Link
Chris Davies
  • 128k
  • 16
  • 178
  • 323

You're losing output because the quoting is wrong.

ssh [email protected] bash -l -c 'echo 111'

What you have here is a call to bash with a requirement to execute echo. The remaining argument 111 is offered to bash but unused. (The result is a blank line.)

What you probably want is one of the following alternatives.

ssh [email protected] 'echo 111'                 # Shell executing echo

ssh -t [email protected] 'echo 111'              # Login shell executing echo

ssh [email protected] 'bash -l -c "echo 111"'    # Shell calling login shell to execute echo