Setting up a path in UNIX


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Setting up a path in UNIX
# 1  
Old 08-04-2011
Setting up a path in UNIX

I have the following script "test". When i tried to execute it, I am not able to run it. I dunno why ? Then i tried getting the first few lines of the script which is displayed below:
Code:
$head -10 test

Code:
#!/bin/ksh
PROG=$0;export PROG
ORAUSER=`get_inf_env INFORM_DB_ACCOUNT`;export ORAUSER
BATCH_HOME=`get_inf_env INFORM_DATA_HOME`

Now i was asked to set the path for the get_inf_env variable. Could some one help me in letting me know abt how to set up a path ? Any help wud be highly appreciated

Thanks

Last edited by Franklin52; 08-04-2011 at 12:50 PM.. Reason: Please use code tags for data and code samples, thank you
# 2  
Old 08-04-2011
get_inf_env is not a variable, it is name of some utility being executed. I think your task is to set PATH variable, so get_inf_env can be run in the script without specifying whole path. To do so try:
Code:
PATH=/path/containing/get_inf_env:$PATH;export PATH

Add this line as the second line in your script.
This User Gave Thanks to bartus11 For This Post:
# 3  
Old 08-04-2011
Quote:
Originally Posted by bartus11
get_inf_env is not a variable, it is name of some utility being executed. I think your task is to set PATH variable, so get_inf_env can be run in the script without specifying whole path. To do so try:
Code:
PATH=/path/containing/get_inf_env:$PATH;export PATH

Add this line as the second line in your script.

So do you want me to include the path in the script itself which will probably take the following format
Code:
#!/bin/ksh
PROG=$0;export PROG
ORAUSER=`get_inf_env INFORM_DB_ACCOUNT`;export ORAUSER
BATCH_HOME=`get_inf_env INFORM_DATA_HOME`
PATH=/path/containing/get_inf_env:$PATH;export PATH


Last edited by Franklin52; 08-06-2011 at 04:40 PM.. Reason: Please use code tags for data and code samples, thank you
# 4  
Old 08-04-2011
to set PATH
you have 2 solutions
The 1st is temp
Code:
$ PATH=$PATH:/pathto_get_inf_env:/somedir

The 2nd is permanent but it depends on your shell for bash as an example

Code:
$ vi ~/.bash_profile

then insert the following line
Code:
export PATH=$PATH:/pathto_get_inf_env:/somedir

Code:
$ echo 'export PATH=$PATH:/pathto_get_inf_env:/somedir' >> ~/.bashrc

or you can add the absolute path to get_inf_env in your script
# 5  
Old 08-04-2011
Quote:
Originally Posted by bobby1015
So do you want me to include the path in the script itself which will probably take the following format

#!/bin/ksh
PROG=$0;export PROG
ORAUSER=`get_inf_env INFORM_DB_ACCOUNT`;export ORAUSER
BATCH_HOME=`get_inf_env INFORM_DATA_HOME`
PATH=/path/containing/get_inf_env:$PATH;export PATH
Yes, it should be in the script, but not after get_inf_env lines, but before:
Code:
#!/bin/ksh
PROG=$0;export PROG
PATH=/path/containing/get_inf_env:$PATH;export PATH
ORAUSER=`get_inf_env INFORM_DB_ACCOUNT`;export ORAUSER
BATCH_HOME=`get_inf_env INFORM_DATA_HOME`

# 6  
Old 08-04-2011
Thanx for all the replies..That was quite informative. Appreciated
But the thing which bothers me is I am not able to find the get_inf_env in the directory.. I have searched in all the directories. But still am not able to find the path for that particular utility..
# 7  
Old 08-04-2011
Did you try this?
Code:
find / -name "get_inf_env" -type f

It will take a while to finish but it will find it if it is present on your server.
This User Gave Thanks to bartus11 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Setting class path

hi , can anybody help me to chage the class path in unix server.. what are the files need to update .... (2 Replies)
Discussion started by: Madhu Siddula
2 Replies

2. UNIX for Dummies Questions & Answers

Is there any $PATH default setting?

This is a very newbie's question: I was trying to add a new version of the same command "blastn", but the old command always shows up first. which blastn /usr/local/bin/blastnThe two versions of the same command "blastn" are located in: which -a blastn /usr/local/bin/blastn... (5 Replies)
Discussion started by: yifangt
5 Replies

3. Solaris

Setting PATH - Vanishes

Hi , I new to solaris. I want to set path variable . Eg: JAVA_HOME. When i do this, #JAVA_HOME=/usr/jdk/jdk1.6 #export JAVA_HOME #echo $JAVA_HOME /usr/jdk/jdk1.6 Then its ok. When i toggle to bourne shell or if i log off or restart. then JAVA_HOME is echoed blank. How to set... (4 Replies)
Discussion started by: gnanagurus
4 Replies

4. Solaris

Problem Setting $PATH

I am trying to install the pkg-get package to a fresh install of Solaris 10. I am able to download and install correctly using the default directory for both pkg-get and wget as found on blastwave.org. When I issue the command "which wget and which pkg-get" it returns no wget or pkg-get found in... (1 Reply)
Discussion started by: greengrass
1 Replies

5. Shell Programming and Scripting

Setting path

Hi all, I have a java command in a shell script. When i m executing the command from the prompt its working fine. But when i paste the same command in a shell script and execute the shell script it says path not found. Please help. (5 Replies)
Discussion started by: radhika03
5 Replies

6. UNIX for Dummies Questions & Answers

Help on setting path variable

Hi there, I need help on setting the path variable. How can I set the path variable with Bourne Shell. My scripts goes like this, but did not work. #!/bin/sh PATH=/usr/bin:/usr/ucb:/etc:/export/home/zchen/home export PATH Thanks, Z (4 Replies)
Discussion started by: randomcz
4 Replies

7. UNIX for Dummies Questions & Answers

Setting $PATH for a particular file...????

:) dear members; I am trying to placea directory to keep minor records in particular directories.. rather than just rely on hard links.. I would like to set the $PATH variable so that I can access the directory itself from anywhere; ex./ /tmp or /bin /var... I know how to export enviromental... (4 Replies)
Discussion started by: moxxx68
4 Replies

8. UNIX for Dummies Questions & Answers

Setting path for GCC?

Dear all, I have downloaded the latest version of gcc --- gcc-3.3.1.tar.gz from gnu.org. My Linux distribution is Mandrake 9.0. This was how I installed it: su - passwrd: mkdir /usr/local/src cd /usr/local/src gunzip /tmp/gcc-3.3.1.tar.gz #where I downloaded the file tar xvf... (2 Replies)
Discussion started by: HOUSCOUS
2 Replies

9. UNIX for Dummies Questions & Answers

Global PATH setting

I am using Solaris 8 and I want to change the PATH setting for all users. I have edited /etc/profile, but when I log in and check the PATH variable, it hasn't changed. Am I missing something? (5 Replies)
Discussion started by: jxh
5 Replies
Login or Register to Ask a Question