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?

3
  • Where did you get the information that gnome-terminal doesn’t have the -e​ option any more? The man pages say otherwise – please try: gnome-terminal -e "ssh …"
    – dessert
    Jan 18, 2020 at 18:01
  • 1
    -e seems like it is deprecated (it is apparently a bug). See here. Anyway, I will edit the question for clarity.
    – ahmedhosny
    Jan 18, 2020 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]". Jan 18, 2020 at 19:24

0

You must log in to answer this question.

Browse other questions tagged .