Create Variable for a PATH


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Create Variable for a PATH
# 1  
Old 11-06-2006
Create Variable for a PATH

Hello all,

I need to create a variable that contains a path to a program. I'd like to reference that variable later in the script to execute the program. Does anyone have any ideas how I can accomplish this?

Thanks,
Mark Smilie
# 2  
Old 11-06-2006
a=/usr/myfolder/file

a is the variable :P

Edit: oh an to execute it:

$a

or
sh $a
# 3  
Old 11-06-2006
Code:
#!/bin/ksh
export MYPATH=/path/to/myfile

#......... later on

$MYPATH/myprogram

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to create 2 different path folders?

Hi all, I am new to this forum. A_NAME=$5 DEPT="abc" DEPT_NAME="cdf" echo " Name:" $A_NAME | tee -a ${LOG_FILE_NAME} echo "dept :" $DEPT | tee -a ${LOG_FILE_NAME} echo "dname :" $DEPT_NAME | tee -a ${LOG_FILE_NAME} echo "parse_parms done" | tee -a ${LOG_FILE_NAME}... (11 Replies)
Discussion started by: Boost
11 Replies

2. Red Hat

How to create PATH for a application?

hi every one In linux, how to create a PATH for a application ? i searched, but no positive response any one like me got stuck with this problem? (3 Replies)
Discussion started by: rajeshz
3 Replies

3. Shell Programming and Scripting

Path a variable to sed that includes a path

Hi I'm trying to select text between two lines, I'm using sed to to this, but I need to pass variables to it. For example start="BEGIN /home/mavkoup/data" end="END" sed -n -e '/${start}/,/${end}/g' doesn't work. I've tried double quotes as well. I think there's a problem with the / in the... (4 Replies)
Discussion started by: mavkoup
4 Replies

4. Shell Programming and Scripting

Appending a path in user's PATH variable

Hello Folks, I want to append a path in user's PATH variable which should be available in current session. Background Numerous persons will run a utility. Aim is to add the absolute path of the utility the first time it runs so that next runs have the PATH in env & users can directly run... (6 Replies)
Discussion started by: vibhor_agarwali
6 Replies

5. Shell Programming and Scripting

one liner to extract path from PATH variable

Hi, Could anyone help me in writing a single line code by either using (sed, awk, perl or whatever) to extract a specific path from the PATH environment variable? for eg: suppose the PATH is being set as follows PATH=/usr/bin/:/usr/local/bin:/bin:/usr/sbin:/usr/bin/java:/usr/bin/perl3.4 ... (2 Replies)
Discussion started by: royalibrahim
2 Replies

6. Shell Programming and Scripting

remove a path from PATH environment variable

Hi I need a script which will remove a path from PATH environment variable. For example $echo PATH /usr/local/bin:/usr/bin:test/rmve:/usr/games $echo rmv test/rmve Here I need a shell script which will remove rmv path (test/rmve) from PATH... (9 Replies)
Discussion started by: madhu84
9 Replies

7. Linux

How to create zip file without path?

Hello, I have generated a PHP script that creates files needed for EPUB file. I have a temp directory where these files are created into and then needs to be zipped. The directory structure is: mimetype content.opf index.html stylesheet.css toc.ncx META-INF META-INF/container.xml ... (4 Replies)
Discussion started by: spaze
4 Replies

8. Shell Programming and Scripting

Makefile cant create new install path

..... (2 Replies)
Discussion started by: mercury
2 Replies

9. UNIX for Dummies Questions & Answers

Want to create 3 different new directories under the same path

Hi, Iam new to UNIX...My requirement is to create 3 dir as an hierarchy under /var/opt/temip.The output should be /var/opt/temip/GP_Int/GPTTS/AUTO. I have tried the following script...But only GP_int folder is getting created and not other folders...Can someone help??? #!/usr/bin/ksh #script... (1 Reply)
Discussion started by: Llb
1 Replies

10. 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
Login or Register to Ask a Question