Question on tweaking the PATH variable to allow the world to run my executable script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Question on tweaking the PATH variable to allow the world to run my executable script
# 1  
Old 03-24-2010
Question on tweaking the PATH variable to allow the world to run my executable script

All,

I am pretty new to Unix and still in the learning curve Smilie I have a simple requirement for which I did not get an answer yet (Atleast I do not know how to keyword the search for my requirement!!!).

I have an executable script
Code:
my.script1

in a folder
Code:
/data/misc/scripts/dev

, which when executed calls 4 other background scripts
Code:
my.background1
my.background2
my.background3
my.background4

all running in background and also in the same folder (/data/misc/scripts/dev). The background scripts never come into picture from an User standpoint.

Now my requirement is I want to give my script (my.script1) to all the users and I dont want them executing the script by giving
Code:
/data/misc/scripts/dev/my.script1

I know PATH variable can be set so that this type of situation can be handled.
can anyone tell me or point me to how this can be handled, so that my script users execute the script by giving only the script name (my.script1) no matter in what folder they are?

Let me know if you require more inputs

Thanks,
Bharath
# 2  
Old 03-24-2010
Only two things can be possible for this senario.

1) add the "/data/misc/scripts/dev/" to the PATH variable for all users.

2) Create a softlink (name it my.script1) in any of your path for /data/misc/scripts/dev/my.script1.
# 3  
Old 03-24-2010
Thanks Amit

Can you tell me how to add the folder to the PATH variable for all the users?
Also how do I create a soft link?

And as I said I will be calling the background scripts in my script. So when I edit the PATH variable to point to the folder where all scripts are placed, how do I call the background scripts within my script, currently I am calling using their absolute path names /data/misc/scripts/dev/background.scripts. I assume this should work fine but can I use background.script name only instead of the entire PATh once the PATH is set.

Please pardon my ignorance! I know my questions are too naive! Just trying to understand.

Thanks Again
Bharath
# 4  
Old 03-24-2010
Sorry i forgot about the background scripts.

In this case the 1 st solution will only work

in users .profile file in home dir add the export command

export PATH=$PATH:/data/misc/scripts/dev

So as all your scripts are in the folder /data/misc/scripts/dev the shell will find all the scripts while executing.


For softlink check the man pages of "ln"
# 5  
Old 03-24-2010
Nevermind. I misread the question.
# 6  
Old 03-24-2010
Quote:
in users .profile file in home dir add the export command

export PATH=$PATH:/data/misc/scripts/dev
Where do I find the .profile file for all users?
I tried checking the /etc/profile. But I do not have access to edit the file as I am not the administrator.

Thanks,
Bharath
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Finding the path to an executable , installed package

Hi all, Recently i wanted to see if i have openssl installed in my system (solaris 10), so i do this (not sure if this is the right way to do this) pkginfo -i | grep -i "ssl" system SUNWopenssl-commands OpenSSL Commands (Usr) system SUNWopenssl-include ... (3 Replies)
Discussion started by: javanoob
3 Replies

2. Solaris

Find path of executable having problem

Hi cannot find the path to a running process on a host. I looked and tried some suggestions in forums to no avail. can someone please help? I need to know where this process is starting from as we have several versions in multiple directories --------- Process name 1201 1 0 Feb 14 ?... (14 Replies)
Discussion started by: mnassiri
14 Replies

3. Shell Programming and Scripting

Script working when run manually but not in crontab showing path not found

i have a script running using variable defined in .profile when i run that script manually its working but when i run the same script through cron its giving path not found I had defined path in .profile (3 Replies)
Discussion started by: raj_saini20
3 Replies

4. UNIX for Dummies Questions & Answers

Getting correct path to run appropriate script

I have tcsh scripts on path /home/chrisd/tatsh/trunk/hstmy/bin/tcsh/ I want to run the script from within another script. Suppose I go to directory /home/chrisd/tatsh/trunk/hsdata/n02/terr0.25/darwin and want to run checksrdist.tcsh So I do cd ... (1 Reply)
Discussion started by: kristinu
1 Replies

5. Shell Programming and Scripting

how to run an already made script run against a list of ip addresses solaris 8 question

how to run an already developed script run against a list of ip addresses solaris 8 question. the script goes away and check traffic information, for example check_GE-VLANStats-P3 1.1.1.1 and returns the results ok. how do I run this against an ip list? i.e a list of 30 ip addresses (26 Replies)
Discussion started by: llcooljatt
26 Replies

6. UNIX for Dummies Questions & Answers

PATH variable and script execution

Hello everyone, I wrote a simple script (ksh) that I would like to be able to execute no matter where in the directory structure I am sitting at. I typed echo $PATH to retrieve my path info and looking at that I decided the directory where to place my script. I copied the scripts to that... (3 Replies)
Discussion started by: gio001
3 Replies

7. Shell Programming and Scripting

Automatically select records from several files and then run a C executable file inside the script

Dear list its my first post and i would like to greet everyone What i would like to do is select records 7 and 11 from each files in a folder then run an executable inside the script for the selected parameters. The file format is something like this 7 100 200 7 100 250 7 100 300 ... (1 Reply)
Discussion started by: Gtolis
1 Replies

8. Shell Programming and Scripting

script run when executable is launched

I need to know how to have a BASH script run every time Firefox is launched, what is the simplest way to do this? (1 Reply)
Discussion started by: glev2005
1 Replies

9. UNIX for Advanced & Expert Users

process executable file full path

hi guys i give "ps -ef | grep some_executable_file" on the command line. this "some_executable_file" resides on many paths which r included in the PATH environment variable, so the output depicts only "some_executable_file" in the COMMAND column. how can i get the full path? thanx (3 Replies)
Discussion started by: xtrix
3 Replies

10. UNIX for Dummies Questions & Answers

How do I make a cgi script World-executable

I'm trying to set up a form mail script on a website that when Submitted, a cgi script is executed and a perl translator (located in a secured and inaccessible folder) translates the script. After speaking to my hosting provider, I was told to "Telnet into the system and make the script... (2 Replies)
Discussion started by: tylerl
2 Replies
Login or Register to Ask a Question