The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
script running with "ksh" dumping core but not with "sh" simhe02 HP-UX 8 05-22-2008 02:46 AM
#!/bin/sh script fails at StringA | tr "[x]" "[y]" by_tg UNIX for Dummies Questions & Answers 3 02-22-2008 08:17 AM
Development Releases: Linux Mint 4.0 Beta "Fluxbox", 4.0 Alpha "Debian" iBot UNIX and Linux RSS News 0 01-04-2008 11:00 AM
Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" Lokesha UNIX for Dummies Questions & Answers 4 12-19-2007 09:52 PM
Making a "Recovery Partition" ?? Akira OS X (Apple) 0 08-22-2007 07:02 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-14-2004
Registered User
 

Join Date: Nov 2004
Location: Los Angeles
Posts: 1
Making your script "universal"

I'm currently using Sun Solaris Unix. How can you make your unix bash or C script usable in all directories and subdirectories and not just the dir the script is located in? Essentially, to make it a command script as universal as a basic unix command like ls or cd.

Thanks for the help!
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 11-14-2004
moxxx68's Avatar
Registered User
 

Join Date: Mar 2004
Posts: 301
if bin is in env $PATH put it in bin otherwise export to path where local commands are.. this is usually bin but some systems are set up different. on my system I have my scripts set up in bin and does the the job.. if you have have scripts to input into other scripts you have written such as a sed -f , egrep -f , gawk -f script.. you may have to export the commands to env using set in the script itself so that it can access child process from the current shell.. otherwise you will need to put the /bin before the command.. .
hope that helps
moxxx68
__________________
moxxx68
http://www.estarinformado.com.ar/apicmaxmiel/bee-diez.gif
Reply With Quote
  #3 (permalink)  
Old 11-14-2004
Registered User
 

Join Date: Aug 2004
Location: standing in a Sun 25k, Vienna
Posts: 78
Try this:

SunOS # ln -s /your/script /usr/bin

/usr/bin must be in the PATH Enviroment Variable

Than you can:

SunOS # pwd
/any/other/path

SunOS # script

Also have a look at the ln manpage


Hope this helps

networkfre@k
Reply With Quote
  #4 (permalink)  
Old 11-14-2004
zazzybob's Avatar
Registered Geek
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
I'd suggest placing any custom site scripts within /usr/local/bin, and then adding that to the global PATH within /etc/profile for Bourne-compatibles (or /etc/csh.login, whatever). Then this is made available for all users.

This way /usr/local/bin should remain untouched in the event of an OS (or other major) upgrade, and hence all your hard work and custom scripting won't be hosed.

Cheers
ZB
Reply With Quote
  #5 (permalink)  
Old 11-14-2004
moxxx68's Avatar
Registered User
 

Join Date: Mar 2004
Posts: 301
thats about as clear as it will get.. !
take it from me... i get advice like that all the time.
moxxx68
cheers
__________________
moxxx68
http://www.estarinformado.com.ar/apicmaxmiel/bee-diez.gif
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 10:35 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0