We help IT Professionals succeed at work.

Add some lines to /root/.bash_profile of Red hat 9 in a script file

2,086 Views
Last Modified: 2013-12-16
Dear All,
How Do you Add  below lines to /root/.bash_profile of Red hat 9 in a script file?

export ns_HOME=/home/administrator/ns-allinone-2.27/
export PATH=$ns_HOME/tcl8.4.5/unix:$ns_HOME/tk8.4.5/unix:$ns_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ns_HOME/tcl8.4.5/unix:$ns_HOME/tk8.4.5/unix:/$ns_HOME/otcl-1.8:$ns_HOME/lib:$LD_LIBRARY_PATH
export TCL_LIBRARY=$ns_HOME/tcl8.4.5/library

Regards
 
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2007
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
it means when i run that script files it added those lines to  /root/.bash_prof.
CERTIFIED EXPERT
Top Expert 2007
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Dear Tintin,
Many Thanks For Your Response.
Is this coding Add those lines To existed /root/.bash_profile file.
or Create a new file without our last entries on /root/.bash_profile.

Ps:i need my last entries.

CERTIFIED EXPERT
Top Expert 2007

Commented:
Hi,

Both of the solutions recommended will add the existing lines in the file.
CERTIFIED EXPERT
Top Expert 2007

Commented:
Hi,
Correction

Both of the solutions recommended will add to  the existing lines in the file.

Author

Commented:
the best condition:
in line 3 can add 5 blank lines.
and insert those 5  lines to it.
CERTIFIED EXPERT
Top Expert 2007

Commented:
Hi,

I was referring to recommendations made by myself and tintin, and answering your question about whether it is adding to the existing file or new file content. The >> is appending to the end of file.

Author

Commented:
Tinti script Return this error to me:
Permission Denied.

Ps: I log on with Root accout.

CERTIFIED EXPERT
Top Expert 2007
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT
Top Expert 2007
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Many thanks for your comments.
tinti , you are right .
But i want to create a script which dont need any other commands before
using this script.
i need when i Execute my script It grant what permissions need for this work.

CERTIFIED EXPERT
Top Expert 2007
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT
Top Expert 2007

Commented:
Hi,

scripts are normally created with editors like vi. These tools will normally create files with rw perms. These perms are controlled by umask.

What tintin recommended is correct.
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.