Making your script "universal"


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Making your script "universal"
# 1  
Old 11-14-2004
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!
# 2  
Old 11-14-2004
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
# 3  
Old 11-14-2004
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
# 4  
Old 11-14-2004
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
# 5  
Old 11-14-2004
thats about as clear as it will get.. !
take it from me... i get advice like that all the time.
moxxx68
cheers
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. AIX

Apache 2.4 directory cannot display "Last modified" "Size" "Description"

Hi 2 all, i have had AIX 7.2 :/# /usr/IBMAHS/bin/apachectl -v Server version: Apache/2.4.12 (Unix) Server built: May 25 2015 04:58:27 :/#:/# /usr/IBMAHS/bin/apachectl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_worker_module (static) ... (3 Replies)
Discussion started by: penchev
3 Replies

2. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

3. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

4. UNIX for Dummies Questions & Answers

"Help with bash script" - "License Server and Patch Updates"

Hi All, I'm completely new to bash scripting and still learning my way through albeit vey slowly. I need to know where to insert my server names', my ip address numbers through out the script alas to no avail. I'm also searching on how to save .sh (bash shell) script properly.... (25 Replies)
Discussion started by: profileuser
25 Replies

5. UNIX for Advanced & Expert Users

What choice when "making" an executable on FreeBSD?

I should make an executable on our server, and are having some problem (I changed this question cause I found out that anser). I'm getting this error when trying to do make: In file included from... /usr/include/sys/file.h:161: error: expected specifier-qualifier-list before 'u_int' *** Error... (1 Reply)
Discussion started by: 244an
1 Replies

6. UNIX for Dummies Questions & Answers

"Universal" sar option to check for paging issues?

Hi, Can anyone please advise a universal command option for using sar to check for paging/memory issues. For Linux, I used sar -B and check on the majflt/s column and a high number is supposed to indicate paging issues, is that correct? Unfortunately, on a Solaris server, sar -B does not... (1 Reply)
Discussion started by: newbie_01
1 Replies

7. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

8. HP-UX

script running with "ksh" dumping core but not with "sh"

Hi, I have small script written in korn shell. When it is called from different script, its dumping core, but no core dump when we run it standalone. And its not dumping core if we run the script using "/bin/sh" instead of "ksh" Can some body please help me how to resolve this issue. ... (9 Replies)
Discussion started by: simhe02
9 Replies

9. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies
Login or Register to Ask a Question