The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to get the path of a file in UNIX? smr_rashmy UNIX for Dummies Questions & Answers 14 05-14-2008 07:34 AM
Unix Career Path NycUnxer What's on Your Mind? 5 10-23-2007 11:48 AM
How to set path for java in UNIX subhotech UNIX for Dummies Questions & Answers 2 07-12-2007 11:57 AM
missing Path(in UNIX) when i launch a job on to unix machine using windows SSh megastar UNIX for Advanced & Expert Users 1 11-04-2005 07:36 AM
UNIX PATH info required PLEASE HELP (I'm new to unix) akitachi UNIX for Dummies Questions & Answers 1 05-10-2002 03:37 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-10-2008
thiyagak85 thiyagak85 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 2
Question PATH in unix

Hi,
I want to know the default precedence of PATH variable (esp in HP Unix).
is /usr/local/bin having higher precedence or /usr/bin?
which tar is better to use /usr/local/bin/tar or /usr/bin/tar?
  #2 (permalink)  
Old 03-10-2008
Dhruva's Avatar
Dhruva Dhruva is offline
Registered User
  
 

Join Date: Mar 2006
Location: India
Posts: 255
Run
Code:
set
command on your prompt to see contents in PATH variable.The shell searches the PATH in order.
/bin:/usr/local:/usr/ucb:/usr/bin
/bin has higher precedence..and so on.

Last edited by Dhruva; 03-10-2008 at 02:17 AM.. Reason: added one line
  #3 (permalink)  
Old 03-10-2008
thiyagak85 thiyagak85 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 2
PATH issue

thanks for reply, but i want to know what is defect precedence between /usr/local/bin and /usr/bin as per unix standard. because i have 2 different env with different precedence and tar is different in both these bins.
  #4 (permalink)  
Old 07-07-2008
ajitabhpandey ajitabhpandey is offline
Registered User
  
 

Join Date: Mar 2008
Location: Bangalore
Posts: 12
There is no standard default precedence. Every Unix based OS have their own PATH preferences. Typically /bin will have higher precedence than the /usr/bin which in turn will have a higher precedence that /usr/local/bin. In order to find out what is the value of the PATH variable in your case you can type the following command at your shell prompt.

Code:
echo $PATH
The directory which appears first in the list will have the higher precedence.
  #5 (permalink)  
Old 07-07-2008
jambesh's Avatar
jambesh jambesh is offline
Registered User
  
 

Join Date: Aug 2006
Location: Pune,India
Posts: 137
Here is some story on using command from diferent path ---
I am not agree on precedence of path ,It is all how your OS is (64 bit/32 bit) and how your file system size.

Example --
I have ls , and rm command in /bin directory also in /usr/bin directory

If you will try to remove a file or list a file which is more then 2GB with simple using the ls or rm command you wont be able to do that if your path sequence is /bin:/usr/bin

Your command will fail.

But when the sequence will /usr/bin:/bin
the command will work ?

Reason : --- Command from /usr/bin directory are large file aware and can access size more then 2^31 -1
While command of /bin directory can access a file size of max 2^31-1 size that is around 2GB not more then that.


It all depend your requirement and put the file in PATH for precedence .

Hope you got some idea
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:04 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0