LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-05-2004, 09:18 PM   #1
mustang05
LQ Newbie
 
Registered: Dec 2003
Posts: 26

Rep: Reputation: 15
Getting a script to run


How do I get a script to execute once i have created it?
 
Old 05-05-2004, 09:25 PM   #2
vdogvictor
Member
 
Registered: Feb 2004
Distribution: Arch
Posts: 498

Rep: Reputation: 31
two ways:

first way:

chmod a+x nameofscript.whatever
./nameofscript.whatever

this way only requires the chmod command the first time

second way:

sh nameofscript.whatever
 
Old 05-05-2004, 10:53 PM   #3
looseCannon
Member
 
Registered: Dec 2003
Location: Little Rock, AR
Distribution: Fedora Core 2, AIX, HP-UX, Solaris, Whitebox
Posts: 193

Rep: Reputation: 31
A little further explination of what vdogvictor was trying to tell you...

In Windows the extension of the file determines if a file is executable or not. *.bat or *.exe are executable files in Windows.

Linux is different. The exetension has nothing to do with wether or not the file is executable. The permissions determine that. When you type in 'ls -l' at a command prompt you'll see a list of everything in the directory along with other information. Look at the first column, those are the permissions.

There are four things listed in the permissions.[list=1][*]Type represented (file, directory, link)[*]Owners permissions[*]Groups permissions[*]Worlds permissions[/list=1]

The second through fifth characters are the Owners permissions, the sixth through eight characters are the Groups permissions, and the last three are the Worlds permissions.

In all three blocks the permissions read, in this order:
r = read permission (4)
w = write permission (2)
x = execute permission (1)

If the Owner/Group/World has the permission then the letter representing it will show up, otherwise a dash (-) will show up.

You can change the permissions with the chmod command. Abbreviations can be used with this command to add or take away permissions of any of the three areas.

u = owner/user
g = group
o = other/world

To add the read permisson for the world use 'chmod o+r'. To take it away use 'chmod o-r'. To give write permission to every type of user use 'chmod +w' (not specifying who it is for applies the change to all areas).

Short answer to the question, you have to make sure you have execute authority for the script.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
'cannot stat' script in /etc/rc.d/, try to run script at startup quintan Linux - Software 1 11-21-2005 02:53 AM
Shell script to run pl/sql script. colly Linux - General 1 09-09-2004 06:49 AM
Script to run script in multiple directories... seabass55 Linux - General 5 07-06-2004 12:44 AM
on Network Up Script run? On Battery power run script? v2-ncl Linux - General 0 12-08-2003 09:34 AM
can't run a script script from icon in konqueror scottsteibel Linux - Software 1 08-02-2003 07:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration