Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running Script from anywhere 1

Status
Not open for further replies.

Moose467

Technical User
Aug 6, 2002
47
GB
Hi to all,
Probably a simple question for someone...

how can I run a unix script from anywhere on the system, like OS commands. I remember from Windows days this was done by adding the directory to the PATH list, is it a similar task on AIX.

Thanks for any help you can give.

Phil
 
Phil,

yes, just add the path to the file in your $PATH vaiable. This is usually done as:

export PATH=$PATH:new_path_to_file

Cheers.
 
Oh, and if you want this chage to be permanent and available on login, add the new path to PATH in your .profile in your home directory, or to /etc/profile if you want all users to have access.
 
Thanks Ken
Thats great, exactly what I needed.

Have a good weekend

Phil
 
watch out for where you put it, searches stop at the first hit. generally this is not a problem but you want "." to be last, if you want it in there at all. IBM Certified -- AIX 4.3 Obfuscation
 
Moose,
As a side note instead of adding a new directory to your search path most unix logins already have a place for such things.
It is usually /usr/local/bin.
After your scripts are working as you expect put them in this directory and all logins should have access.

This may be slightly different on different systems so just type $PATH to see your current path. You will see a listing similar to this.

Good Luck
Doug
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top