Sponsored Content
Top Forums Shell Programming and Scripting Adding to the end of the path in .profile Post 302970639 by Don Cragun on Saturday 9th of April 2016 03:53:41 PM
Old 04-09-2016
Quote:
Originally Posted by Scrutinizer
You need to use a different RE delimiter, because _ also occurs in the replacement string. Instead of _ try |
Code:
sed 's|export PATH=/usr/bin:/usr/sbin|export PATH=/usr/bin:/usr/sbin:/usr/jdk/jdk1.8.0_60|g' .profile

or
Code:
sed 's|export PATH=/usr/bin:/usr/sbin|&:/usr/jdk/jdk1.8.0_60|g' .profile

or perhaps even
Code:
sed 's|export PATH=.*|&:/usr/jdk/jdk1.8.0_60|g' .profile

I think a typo sneaked into the replacements... There isn't any need for a global substitution here. I think you meant:
Code:
sed 's|export PATH=/usr/bin:/usr/sbin|export PATH=/usr/bin:/usr/sbin:/usr/jdk/jdk1.8.0_60_g|' .profile

or
Code:
sed 's|export PATH=/usr/bin:/usr/sbin|&:/usr/jdk/jdk1.8.0_60_g|' .profile

or
Code:
sed 's|export PATH=.*|&:/usr/jdk/jdk1.8.0_60_g|' .profile

This User Gave Thanks to Don Cragun For This Post:
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Modifying $PATH variable in /etc/profile

In my /etc/profile, my $PATH variable is set as follows: $PATH =/sbin:/usr/sbin:/usr/bin:/etc Then how do I add an additional directory to it? say /export/home/abd/rose Please advise. Thanks! Deepali (3 Replies)
Discussion started by: Deepali
3 Replies

2. Shell Programming and Scripting

taking the end off a path

I need a script to be able to take a path such as "/foo/bar/thing" a put the "/foo/bar/" bit in one variable and the "thing" bit in another. I figured awk would probably be the best tool for the job but looking at the man page didn't seem to help. The only way i know how to use awk is with... (12 Replies)
Discussion started by: Nat
12 Replies

3. UNIX for Dummies Questions & Answers

adding a column at the end of the record

hello., i have a .txt file. inside the .txt file i have., /home/ss/cca.costco.transaction_date /home/sk/cca.costco.transaction_date /home/st/cca.costco.transaction_date /home/sv/cca.costco.transaction_date cca.costco.transaction_date is the file name. inside the file there are some... (2 Replies)
Discussion started by: pavan_test
2 Replies

4. UNIX for Dummies Questions & Answers

Edited Path in Profile File

Definitely a unix dummy. I edited the paths in the /etc/profile file - following the instructions on an install package. Now can't use vi, cat pg ls or any other unix commands. Guess I'm in big trouble. Path reads MANPATH=/opt/hpnp/man PATH=/opt/hpnpl/bin LD_LIBRARY_PATH=/opt/hpnp/lib ... (4 Replies)
Discussion started by: thewetch
4 Replies

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

6. UNIX for Dummies Questions & Answers

full path of .profile in unix

need a help, am a newbe in unix how do i locate the full path of the .profile where the environmental variable for a user is set. thanks (6 Replies)
Discussion started by: dba
6 Replies

7. UNIX for Dummies Questions & Answers

echo $PATH doesn't match $HOME/.profile

This is on a Solaris 9 box, but I feel like a noob, so I am posting here. When I echo $PATH I get a lot of duplicate paths and extra stuff I don't need. What I want is just what I set up in my home dir under .profile My login shell=/bin/bash I checked the following and there are no path... (1 Reply)
Discussion started by: Veestan
1 Replies

8. UNIX for Dummies Questions & Answers

profile PATH include subdirectories

I would like to modify my .profile PATH to include all subdirectories of the directory I specify. For example, right now I have PATH=$HOME/tier1 Tier1 has a tier2 directory in it. Right now I can execute files from tier1, but not tier2. I know I can add another path with $HOME/tier1/tier2,... (1 Reply)
Discussion started by: Smed
1 Replies

9. Shell Programming and Scripting

Adding a comma at the end

Hallo Team, I have a big file and the sample looks like below: 0105550 0105550 0105550 0105550 0105550 0125550 0125550 0125550 0125550 0125550 0215650 0215650 0215650 0215650 0215650 0315550 (3 Replies)
Discussion started by: kekanap
3 Replies
All times are GMT -4. The time now is 06:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy