The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Problem Setting $PATH greengrass SUN Solaris 1 04-07-2007 08:40 PM
Setting path radhika03 Shell Programming and Scripting 5 01-22-2007 09:11 AM
Setting $PATH for a particular file...???? moxxx68 UNIX for Dummies Questions & Answers 4 10-08-2004 12:23 AM
Setting path for GCC? HOUSCOUS UNIX for Dummies Questions & Answers 2 09-16-2003 08:44 PM
Global PATH setting jxh UNIX for Dummies Questions & Answers 5 07-20-2001 02:23 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 11-15-2006
Registered User
 

Join Date: Nov 2006
Posts: 4
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
Reply With Quote
Forum Sponsor
  #2  
Old 11-15-2006
Registered User
 

Join Date: Oct 2002
Posts: 676
You have the correct syntax. What is the problem you are experiencing?
Reply With Quote
  #3  
Old 11-15-2006
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,699
How did you invoke the script ?

Try this
Code:
. myscript.sh
or just source it.
Code:
source myscript.sh
Reply With Quote
  #4  
Old 11-15-2006
Registered User
 

Join Date: Nov 2006
Posts: 4
when i invoke the script by using interactive command, i.e.

set path=($path /export/home/zchen/home)

it works fine, but when i invoke by sh myscript.sh, it does not work.

any idea?
Reply With Quote
  #5  
Old 11-15-2006
Registered User
 

Join Date: Oct 2002
Posts: 676
Like vino said, if you want the PATH to affect your current shell, you need to source the script. Look at his post again.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 03:56 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0