1

In my bash script, I would like to ssh into a machine, run a command, and keep the terminal open. I currently have this which works in the current terminal:

ssh -t -i path_to_key ubuntu@ip '<commands_sperated_by_;>;command;/bin/bash'

Now I would like to run this in a new terminal. I am using gnome-terminal.

gnome-terminal -- "ssh -t -i $path_to_key ubuntu@$aws_ip 'ls;cd /;command;/bin/bash'"

This does open a new terminal but complains that "There was an error creating the child process for this terminal. Failed to execute child process “ssh ...” (No such file or directory).

Any ideas?

ahmedhosny
  • 111
  • 4
  • Where did you get the information that `gnome-terminal` doesn’t have the `-e`​ option any more? [The man pages](http://manpages.ubuntu.com/manpages/eoan/en/man1/gnome-terminal.1.html) say otherwise – please try: `gnome-terminal -e "ssh …"` – dessert Jan 18 '20 at 18:01
  • 1
    -e seems like it is deprecated (it is apparently a bug). See [here](https://askubuntu.com/questions/1116385/option-e-is-deprecated-and-might-be-removed-in-a-later-version-of-gnome-termi). Anyway, I will edit the question for clarity. – ahmedhosny Jan 18 '20 at 18:36
  • 4
    Try simply removing the outer quotes i.e. `gnome-terminal -- ssh -t -i $path_to_key ubuntu@$aws_ip 'ls;cd /;command;/bin/bash'` - it seems like the `gnome-terminal -- COMMAND` expects `COMMAND` to be separate `command [args]` rather than a quoted string `"command [args]"`. – steeldriver Jan 18 '20 at 19:24

0 Answers0