Question:
how to execute a sh file through terminal?
Daniel
2013-02-14 02:26:12 UTC
Okay, so I am new to Linux, and I don't really know how it works.
I was trying to execute the sh file for Katawa Shoujo, and I couldn't so I asked here on Yahoo.
I was told that I should try through terminal. So I tried, but everytime I make the command it says there's no such file or directory.

I've tried bash
sudo bash
sh
sudo sh and many more, but none seems to work, it still says "There's no such file or directory"
Five answers:
hawklord
2013-02-14 03:09:57 UTC
easy,



right click on the shell script and choose run in terminal



or



if you want to do it in a terminal, then just type the full path

or alternatively, type



./(name of file).sh



you may also need to make the shell script executable



right click the file > properties > permissions > make executable



or, in a terminal



chmod +x (name of file).sh
2016-11-15 05:58:19 UTC
Execute Sh File
jplatt39
2013-02-14 05:00:33 UTC
sh .sh or do an ls to see if it's executable (it should show up green). If it doesn't do a chmod +x .sh replacing filename with the base of the filename of course. Then ./.sh. The ./ (dot-slash) means execute the file in this directory.



EDIT: My instructions won't work unless you are in the directory that the shell script is in. If the script is not in your home directory then do a sudo chmod a+x /.sh with path to being the path as in /usr/share/mkinitrd/mkinitrd_command_generator.sh
Jim
2013-02-14 03:16:20 UTC
FYI filenames with spaces in them you need to surround with double quotes.

I forget, but I think it would be

"./abc def ghi.sh"

or maybe it was

./"abc def ghi.sh"

but I think it was the former
Nrike
2013-02-14 02:30:10 UTC
try

filelocation/file



or



sh file


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...