LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Running a .sh file (https://www.linuxquestions.org/questions/linux-newbie-8/running-a-sh-file-293511/)

mcedpd 02-22-2005 02:35 PM

Running a .sh file
 
Hello, I'm trying to install epijs and the final step is to run a file with the extension .sh. How do I go about doing this?
Do I use the command prompt window? Can I just double click on it?
Also, does anybody know how to convert c source code, that's supposed to be used with a castle compiler, so it can be compiled with gcc?

I look forward to hearing from you soon, Cheers, Dom.

noobtesting 02-22-2005 02:48 PM

I think in console you will need to type:

./filename.sh

then press enter not sure if you have to be root but it never hurts to be safe.

koodoo 02-22-2005 02:53 PM

Hi,

You can run the .sh file from the command prompt window.

Just open a terminal window and cd to the directory that contains

the .sh file. Then type :

[root@localhost root] ./<filename.sh>

(without the '< >' signs)

This should work. If it dosen't then probably the file is not executable

and u will have to make it executable. Type :

[root@localhost root] chmod +x <filename.sh>

[root@localhost root] ./<filename.sh>

This should work.

Refer to the chmod man pages for more help

ciao.

satinet 02-22-2005 04:07 PM

if you just type the path to a file it will try to execute it e.g.

/opt/kde/bin/k3b will start the K3b cd tool on my box

as well as ./filename you can also use the syntax

sh filename

as noted above the file has to have the relevant permissions....

so sayeth a unix admin...........

sh1ft 02-22-2005 04:24 PM

Quote:

Originally posted by noobtesting
I think in console you will need to type:

./filename.sh

then press enter not sure if you have to be root but it never hurts to be safe.

That's fine if it's executable, as koodoo said if it's not it won't run then you must chmod it (quite a few extra steps).

I run all my .sh files by doing:
Code:

$ sh ./whatever.sh
This ensures it will run whether it is executable or not.

jschiwal 02-22-2005 06:58 PM

The .sh extension might also mean that the script file doesn't use any bash extensions. Starting the program as 'sh <filename>.sh will run bash in a mode compatible sh.

Mostly, a downloaded file or a file in cdrom may not have executable bit set, or will have a different owner. using 'sh <filename>.sh' will save you the trouble. The extension itself means nothing to the system, but is just a convention and visual clue.

mcedpd 02-23-2005 04:00 AM

Nice one, cheers people, what should happen in the command window after that? When I've installed other things there's normally a huge amount of text scrolls up the screen as it installs, but with this there wasn't, is this normal?

jschiwal 02-26-2005 06:34 AM

You said it was the final step. Perhaps you've already done most of the work. If the script installs pre-compiled binaries, it may simply need to copy files to target directories. I don't know that this particular installation does. If it is a script, you could read it to find out what is does.


All times are GMT -5. The time now is 01:01 PM.