PATH variable settings


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting PATH variable settings
# 1  
Old 04-08-2008
PATH variable settings

The contents of My PATH variable gets printed more than once if get it using the command
Code:
echo $PATH

Is there any way to set it right
# 2  
Old 04-08-2008
Can you show the output from env | fgrep PATH and from echo $PATH? I would speculate that you simply have the same PATH listed multiple times.
# 3  
Old 04-09-2008
:)

Thats true I have the same path listed multiple times
Why is it so ??
# 4  
Old 04-09-2008
Usually this is because it gets built up piecemeal, there are scripts starting in /etc/environment and /etc/profile and then successively a bunch of your personal shell start-up scripts which are probably copies or modifications of centrally-managed scripts in /etc/skel or someplace like that. It's not unusual for several of them to contain a snippet to make sure that a particular PATH component is there, and often they're lazy and just add it one more time even if it might already be there, because it's much simpler to code, and doesn't hurt (much).
# 5  
Old 04-15-2008
Is there any possible way I can set it right ,Am working on SLES 10 .which of the files do i have to modify to check for the presence of the PATH variable before it prints it
# 6  
Old 04-15-2008
Depends on your shell; different shells read different start-up files. Probably your .profile or similar would be a suitable place to run a short PATH clean-up script.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

PATH settings don't seem to persist across sessions

I recently installed LaTeX on my linux machine and I attempted to add a directory to the PATH as the instructions say to do. They tell me to give the following command: PATH=/usr/local/texlive/2011/bin/i386-linux:$PATH; export PATH After I do this I can use commands such as "pdflatex" anywhere,... (5 Replies)
Discussion started by: TR5
5 Replies

2. 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

3. 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

4. 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

5. 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

6. Solaris

effect of change of mpd preferred path settings

Hello All, In the output of the command "mpdcontrol -no xlist", I found that, some of the preferred paths are marked as "err". You can see the output below: # mpdcontrol -noxlist Unit Dev# MPD_ID/Policy DeviceName FC_AL DevMajMin IOcnt State... (0 Replies)
Discussion started by: sundar3350
0 Replies

7. 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

8. Shell Programming and Scripting

Getting the path from a variable

Hi, I am having a variable Like line="/dir1/dir2/gr3/file.ksh" I need to get the /dir1/dir2/gr3 alone. the no of directories may differ at each time. Please advice. thanks in advance. (3 Replies)
Discussion started by: vanathi
3 Replies

9. UNIX for Dummies Questions & Answers

adding PATH variable

Hello i use bash and i added a path variable for 2 files /rscr and /uscr in /etc/profile /rscr working fine but the other one shows command not found and when i try to type whereis for scripts in /rscr it shows them but the other one shows nothing... thanks :b: (3 Replies)
Discussion started by: wir3d
3 Replies
Login or Register to Ask a Question