The error
Failed to execute child process "cd" (No such file or directory)
arises because cd
is one of the SHELL BUILTIN COMMANDS
and not an executable that you physically find on your Hard Disk.
To run it or the others built-in
commands in you script you need to pass all the line to a bash
invocation
gnome-terminal -e '/bin/bash -c "cd ~/Desktop/CCA/; ./Adventure" '
If there are no other internal command that you have to execute you can set the working directory for the gnome terminal
, as just answered here:
gnome-terminal --working-directory=/home/username/Desktop/CCA/ -e './Adventure'
Ad nauseam: there are some alternatives:
If you are just in a terminal you can either do
an alias
like
alias Star_My_Game="cd ~/Desktop/CCA; ./Adventure "
and put it in your .bashrc
or in ~/.bash_aliases
so that you will be able to run with the single command Start_My_Game
in each shell you will be (It's more cosy to choose a simpler/short name than Start_My_Game...)
or a script that you can make executable (chmod u+x MYscript
) and put in your path
(tipically ~/bin
is a good candidate).
I suppose you can put a link on your desktop that execute the terminal and modify the starting behaviour. From gnome help
Select Edit ▸ Profile Preferences ▸ Title and Command.
Check Run a custom command instead of my shell.
In the text box, type the command or the desired shell.
The command will be passed to the terminal exactly as you write it,
including any arguments that you specify. Environment variables will
be inherited from the terminal as it is a child process of the
terminal.
Open a new Terminal tab or window to see how the custom shell or
command executes
cd
wasn't a command. – Giaphage47 May 28 '14 at 06:14cd
certainly is a command! It's what is known as a shell builtin command, as Hastur's answer correctly states. Shell builtin commands are often called "shell builtins" or "builtins" for short, but they are absolutely commands. Whatcd
is not is an external command. Ubuntu has nocd
program (and if it did, running it still wouldn't have the effect of changing the directory in the shell from which you ran it). @Giaphage47 – Eliah Kagan Oct 12 '17 at 08:07