Error: Failed to execute child process Failed to execve: No such file or directory

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 directory

If 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!

1

1 Answer

Change your script to this:

#! /bin/sh
cd ~/DevSpace/AndroidStudio/arctic_fox/bin/ && ./studio.sh

You 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).

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like