Hello I have the following script, I am learning shell scripting:
#! /bin/sh
gnome-terminal -- 'cd ~/DevSpace/AndroidStudio/arctic_fox/bin/ && ./studio.sh'After running this I get the following error:
“cd ~/DevSpace/AndroidStudio/arctic_fox/bin/ && ./studio.sh”: Failed to execve: No such file or directoryIf I run this command on terminal cd ~/DevSpace/AndroidStudio/arctic_fox/bin/ && ./studio.sh it works just fine. Now I want to write this as a script instead but can't seem to run it.
The goal of this script is very simple. cd to the said folder and then run ./studio.sh. Extremely basic but I am stuck.
What am I missing? I need help finding errors on this simple script.
Thanks!
11 Answer
Change your script to this:
#! /bin/sh
cd ~/DevSpace/AndroidStudio/arctic_fox/bin/ && ./studio.shYou likely don't need to use gnome-terminal.
Your script is a shell script, which uses your system's installation of sh as its interpreter. A shell script can run independently from any terminal.
To understand the difference between a shell and a terminal, perhaps consider reading the answers to What is the exact difference between a 'terminal', a 'shell', a 'tty' and a 'console'? (though don't be alarmed if the answers are over your head at this stage).