1

I have tried this for my Script:

#!/bin/sh
gnome-terminal -- cd Server
gnome-terminal -- ./start.sh

However when I run it I get this error:

It also opens two terminals when I just want one with two commands.

There was an error creating the child process for this terminal

Failed to execute child process “cd” (No such file or directory)

How do I get the commands to run correctly?

I am on Ubuntu 19.04 and a complete newbie.

tdubz
  • 41

1 Answers1

5

cd is a shell builtin command - you can't execute it directly in a terminal, it needs a shell.

So for example

gnome-terminal -- sh -c 'cd Server && ./start.sh'

(you may need to give an absolute /path/to/Server depending on where you are running the command from).

steeldriver
  • 136,215
  • 21
  • 243
  • 336