PATH issue on linux

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat PATH issue on linux
# 1  
Old 07-09-2009
PATH issue on linux

If PATH is set to ../bin:../sbin:/usr/bin:/usr/local/bin (chunk of path string). Sometime when I try to execute ls command it says ../bin/ls not found. According to my understanding "ls" should be searched in all the path varibales that we set in the PATH varaibale.

Is there any reason for the specific problem? I am having this issue on Linux. Please help me with this.

Thanks in advance,
# 2  
Old 07-09-2009
It might be choking on those relative paths, stopping when it tries to check for ls in a directory that does not exist relative to the current location. Is it possible to make them all absolute paths?
# 3  
Old 07-09-2009
I agree. Using relative paths for the PATH variable is a poor way of handling it.
# 4  
Old 07-09-2009
why we need to set the absolute path? If I am using my own application or binaries I like to set the relative path. But for system binaries definitely I use absolute path.
# 5  
Old 07-10-2009
Because setting the relative path breaks things the moment you change directories and it is a bad idea. You came looking for help. People told you what you are doing is wrong.

The PATH variable is meant to be a static variable. If you choose to override that with a bad decision, by all means, do so. However, you will be the one who has to deal with it. There is no reason to use a relative path in the PATH variable. The entire purpose of the PATH is so that relative paths don't matter as you can call on any binaries in the PATH with shortened commands.

Also, if you MUST use a relative path, and thats rather ridiculous, make your path $PATH:../bin, etc.

However, thats just plain WRONG. You should set it in your path, at the END of the string and never have to worry about which directory you are in.

Last edited by mark54g; 07-10-2009 at 09:25 AM..
# 6  
Old 07-10-2009
Thank you so much Mark.

Just before asking the question why, I should have read this article.
What is PATH? -- definition by The Linux Information Project (LINFO)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Linux

Enye issue filenaming and path

Hi All, Is there anyone encounter filenaming with Ñ or ñ reading?. Is the any other way to handle enye both redhat environment and java? We look in the log and founfout reading pathname or filename with enye Ñ, look like MONTA?O instead of MONTAÑO. We tried to transfer files from my windows... (4 Replies)
Discussion started by: lxdorney
4 Replies

2. AIX

issue AIX MPIO path closed

Hello, I have encountered the issue on my AIX 6.1. As you can see below, the hdisk1 & hdisk8 are not recognized by the system / > lspv hdisk0 00fa6d1288c820aa rootvg active hdisk1 00fa6d1288c8213c None hdisk2 ... (9 Replies)
Discussion started by: Phat
9 Replies

3. UNIX for Beginners Questions & Answers

Simple sed command not working; could be a Mac/Linux vs. PC/Linux issue

Hello, I am on a Mac and trying to clean up some monthly files with a very simple SED: sed '3,10d;/<ACROSS>/,$d' input.txt > output.txt (from the input, delete lines 3 - 10; then delete from the line containing <ACROSS> to the end of the file) then output to output.txt Even when I try... (2 Replies)
Discussion started by: verbatim
2 Replies

4. Shell Programming and Scripting

ksh - variable to be set to windows path issue

Greetings Experts, I need to pass a parameter to ksh and the value is windows path eg: sh abc.txt C:\Users\chill3chee\Desktop No matter I try with \ delimiter, still could not get this exact value assigned to the shell variable which was checked with echo. Tried with using... (2 Replies)
Discussion started by: chill3chee
2 Replies

5. UNIX for Dummies Questions & Answers

Prompt path display issue

I use the following command to print the current directory above the command prompt set prompt="`exec pwd`\n$USER@`hostname -s` %B: % > " The output is something like this <current path> $USER@hostname > But when I try to CD to any other directory and press the return key, the... (6 Replies)
Discussion started by: aelhosiny
6 Replies

6. UNIX for Dummies Questions & Answers

Path variable in Linux?

Hi guys, In Windows, whenever I want a execute a program using just a relative path on the command prompt, I simply edit the 'Path' variable and append my parent directory. Is there something like this available in Unix? I have a binary for Virtualbox called VBoxManage that I want to execute... (6 Replies)
Discussion started by: silverdust
6 Replies

7. Shell Programming and Scripting

LaunchAgent file path issue

This is weirdly a linux question I suppose. Im having a problem with this code the file path is fine if I don't use the ~ and put in the user /Users/tempuser/.... This will be installed on more than one computer and changing the plist for every install is going to become tedious. Is there... (1 Reply)
Discussion started by: digitalviking
1 Replies

8. UNIX for Dummies Questions & Answers

PLease HELP!!! PATH variable issue

Hello, I logged in to the unix solaris with my user name and then I again logged in with the sudo bash -l command now when I do echo $PATH It shows me => /usr/bin:/usr/local/bin:/usr/bin/usr/sbin:/usr/ucb:/usr/local/bin How do i find out where is this file located for setting the... (3 Replies)
Discussion started by: siddhans
3 Replies

9. UNIX for Advanced & Expert Users

library path in linux

Is there something which is an alternative to the variable LD_LIBRARY_PATH? The behaviour of this variable is that the path specified here will be checked before checking usual paths. But I want to have some folders checked for shared libraries after the usual paths. i.e usual paths have to... (3 Replies)
Discussion started by: bbala
3 Replies

10. UNIX for Dummies Questions & Answers

issue with PATH

hello On Debian Lenny, I first ran apt-get install git-core and then removed it to install from source. The trouble is that when I typed git --version, I am get: -bash: /usr/bin/git: No such file or directory of course, git is now in /usr/local/bin I don't understand why since... (1 Reply)
Discussion started by: JCR
1 Replies
Login or Register to Ask a Question