enviorment variable


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers enviorment variable
# 1  
Old 09-27-2005
enviorment variable

Hi ,

I am begginer to UNIX. when i want to run korn shell script i run ./test.sh and then enter it would run. But when i run test.sh and enter it would not run. What setting or enviorment variable i would change in order to run with out giving ./ to run any shell script.

Thanks in adavance

sam70
# 2  
Old 09-27-2005
You can have to had the directory where the test.sh is to the PATH.
Something like this:
PATH=$PATH:/home/user/directory_where_the_test.sh_is
export PATH

This works, until you restart again.
# 3  
Old 09-27-2005
You should add the full path to your .profile file in your home directory then you'll be fine. This way, you won't have to do it again when you re-open your session.
# 4  
Old 09-27-2005
profile file

hi,

Yes i understood to add path in .profile . but what path i should add in .profile.

Thanks
# 5  
Old 09-28-2005
The PATH where your file is. Look in your /etc/profile file and you'll find something like

PATH=/usr/bin:/usr/ccs/bin:/usr/contrib/bin:/opt/sudo/bin...

Just add the path of your file at the end.

When you will be opening a new session, type the following to see the content of your PATH variable that should include your new PATH :

echo $PATH
# 6  
Old 09-29-2005
Or you add a . to your PATH environment variable, so that you will always find files that are in your current directory. Something like...

export PATH=.:$PATH
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Running ts_calibrate for touchscreen on emmbedded Linux enviorment

Hey guys, I am trying to figure out why this touchscreen is not working. I am attempting to run ts_calibrate which (on my kernel) can be found @ usr/bin When I run the script: root:/usr/bin# ts_calibrate xres = 1920, yres = 1080 tslib: Selected device is not a touchscreen (must support ABS and... (1 Reply)
Discussion started by: Circuits
1 Replies

2. Ubuntu

The best distro to use on enviorment headless and only run scripts

Hello, I pretend create a machine headless for only run scripts! I think use Ubuntu Server, but this is the best option? Exist another system more light? Because the purpose is run script which do mathematical calculations. Sum, Division and Modules! My knowledge about word gnu/linux is on... (0 Replies)
Discussion started by: enodev
0 Replies

3. Shell Programming and Scripting

[Solved] How to increment and add variable length numbers to a variable in a loop?

Hi All, I have a file which has hundred of records with fixed number of fields. In each record there is set of 8 characters which represent the duration of that activity. I want to sum up the duration present in all the records for a report. The problem is the duration changes per record so I... (5 Replies)
Discussion started by: danish0909
5 Replies

4. Red Hat

How to pass value of pwd as variable in SED to replace variable in a script file

Hi all, Hereby wish to have your advise for below: Main concept is I intend to get current directory of my script file. This script file will be copied to /etc/init.d. A string in this copy will be replaced with current directory value. Below is original script file: ... (6 Replies)
Discussion started by: cielle
6 Replies

5. Shell Programming and Scripting

Not able to store command inside a shell variable, and run the variable

Hi, I am trying to do the following thing var='date' $var Above command substitutes date for and in turn runs the date command and i am getting the todays date value. I am trying to do the same thing as following, but facing some problems, unique_host_pro="sed -e ' /#/d'... (3 Replies)
Discussion started by: gvinayagam
3 Replies

6. Shell Programming and Scripting

Split variable length and variable format CSV file

Dear all, I have basic knowledge of Unix script and her I am trying to process variable length and variable format CSV file. The file length will depend on the numbers of Earnings/Deductions/Direct Deposits. And The format will depend on whether it is Earnings/Deductions or Direct Deposits... (2 Replies)
Discussion started by: chechun
2 Replies

7. Shell Programming and Scripting

How to define a variable with variable definition is stored in a variable?

Hi all, I have a variable say var1 (output from somewhere, which I can't change)which store something like this: echo $var1 name=fred age=25 address="123 abc" password=pass1234 how can I make the variable $name, $age, $address and $password contain the info? I mean do this in a... (1 Reply)
Discussion started by: freddy1228
1 Replies

8. Shell Programming and Scripting

Insert a line including Variable & Carriage Return / sed command as Variable

I want to instert Category:XXXXX into the 2. line something like this should work, but I have somewhere the wrong sytanx. something with the linebreak goes wrong: sed "2i\\${n}Category:$cat\n" Sample: Titel Blahh Blahh abllk sdhsd sjdhf Blahh Blah Blahh Blahh Should look like... (2 Replies)
Discussion started by: lowmaster
2 Replies

9. Shell Programming and Scripting

Sed variable substitution when variable constructed of a directory path

Hello, i have another sed question.. I'm trying to do variable substition with sed and i'm running into a problem. my var1 is a string constructed like this: filename1 filerev1 filepath1 my var2 is another string constructed like this: filename2 filerev2 filepath2 when i do... (2 Replies)
Discussion started by: alrinno
2 Replies

10. UNIX for Advanced & Expert Users

How To Set Enviorment ?

I use /bin/ksh As we know that if we export an enviorment in command terminal, then the enviorment can be used in that termial , it can not take effect in other terminals . How Can I export an enviorment in a terminal , and the enviorment can take effect in other terminals ? (1 Reply)
Discussion started by: chenhao_no1
1 Replies
Login or Register to Ask a Question