Computing.Net > Forums > Unix > Executing Shell scripts?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Executing Shell scripts?

Reply to Message Icon

Name: vvume
Date: June 26, 2000 at 12:18:18 Pacific
Comment:

I am kind of a newbie to UNIX... how do you execute shell scripts? I created a new file called test and copied the script from a website. I tried fiddling around with chmod (chmod +rwx test) command, but the script does not run at all. I know I have to do something with chmod command to make the script executable. can anyone help? thanx.



Sponsored Link
Ads by Google

Response Number 1
Name: Jens
Date: June 26, 2000 at 12:40:17 Pacific
Reply:

High, you shouldn´t call your script test, because there is a unix command called test. Rename yout script by using the following command: mv


0

Response Number 2
Name: Hemant Sharma
Date: June 26, 2000 at 13:09:32 Pacific
Reply:

There are 2 ways
$chmod +x
$./ #if the file is in current dir .
2
$ sh

You can refer to following link for more on shell programming
http://www.adminschoice.com -> unix


0

Response Number 3
Name: Sherlock
Date: June 27, 2000 at 16:31:02 Pacific
Reply:

Before using a file as a shell script you must change its access permissions so that you have execute permission on the file, otherwise the error message Permission deniedis displayed.

To run the shell script, simply type its name at the prompt. The commands in the script will then execute one at a time as though you were typing them in at the terminal.

To give yourself execute permission for the file containing the script use the command:

chmod u+rwx filename

The +rwx after the u allows you to read, write to and execute the script: no one else has permission to read, write or execute.

To give other users permission to read and execute but not alter the shell script use:

chmod go+rx filename

Regards,
Sherkock.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Executing Shell scripts?

execute shell script in SP informix www.computing.net/answers/unix/execute-shell-script-in-sp-informix/8084.html

Call shell script from C++ program www.computing.net/answers/unix/call-shell-script-from-c-program/2276.html

Unix SHELL SCRIPTS www.computing.net/answers/unix/unix-shell-scripts/4885.html