About bearparc

A software development blog for the qualified developer

Blogroll

Application Server (24)
Business Intelligence (13)
Business Logic Layer (6)
C (2)
C++ (3)
CMMI (4)
Data Mining (3)
DataMart (11)
DataWarehouse (11)
ETL (7)
FAQ – Troubleshooting (8)
Framework (4)
Hardware (10)
Informatica Powercenter (6)
Investition (2)
J2ee (8)
Java (6)
JBoss (1)
Liferay (11)
LINUX (11)
objektorientiertes Design (2)
OLAP (7)
Oracle (48)
Projektmanagement (5)
Prozeßmodelle (4)
Software (33)
SQL (24)
Uncategorized (31)
Web 2.0 (5)
Weblogic (17)
wordpress (5)
XML (2)

WP-Cumulus by Roy Tanck and Luke Morton requires Flash Player 9 or better.

8024402c ¤ busy ¤ oracle ¤ with ¤ nowait ¤ this ¤ ora-00845 ¤ resource ¤ memory_target ¤ linux ¤ to_integer ¤ acquire ¤ informatica ¤ zeilen ¤ ora-00054: ¤ specified ¤ supported ¤ workflow ¤ system ¤
ora-00845 linux ¤ ora-00845: memory_target not supported on this system ¤ ora-00845 ¤ ora-00054 ¤ ora-00054: resource busy and acquire with nowait specified ¤ informatica workflow ¤

www.brokerbase.ch network

Search



Add to Technorati Favorites Blogverzeichnis - Blog Verzeichnis bloggerei.de Deutsches Blog Verzeichnis blogoscoop Add to Google http://www.wikio.de
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading ... Loading ...

« | Main | »

Linux : Adding a Directory to the Path

By Martin | November 4, 2009

The best place to add a directory to the path of a single user is to modify that user’s .bash_profile file.
To add it to all users except user root, add it to /etc/profile.
To also add it to the path of user root, add it to root’s .bash_profile file.

Linux determines the executable search path with the $PATH environment variable. To add directory /data/myscripts to the beginning of the $PATH environment variable, use the following:

PATH=/data/myscripts:$PATH
To add that directory to the end of the path, use the following command:

PATH=$PATH:/data/myscripts
But the preceding are not sufficient because when you set an environment variable inside a script, that change is effective only within the script. There are only two ways around this limitation:

If, within the script, you export the environment variable it is effective within any programs called by the script. Note that it is not effective within the program that called the script.
If the program that calls the script does so by inclusion instead of calling, any environment changes in the script are effective within the calling program. Such inclusion can be done with the dot command or the source command. Examples:
. $HOME/myscript.sh
source $HOME/myscript.sh
Inclusion basically incorporates the “called” script in the “calling” script. It’s like a #include in C. So it’s effective inside the “calling” script or program. But of course, it’s not effective in any programs or scripts called by the calling program. To make it effective all the way down the call chain, you must follow the setting of the environment variable with an export command.

As an example, the bash shell program incorporates the contents of file .bash_profile by inclusion. So putting the following 2 lines in .bash_profile:

PATH=$PATH:/data/myscriptsexport PATH
effectively puts those 2 lines of code in the bash program. So within bash the $PATH variable includes $HOME/myscript.sh, and because of the export statement, any programs called by bash have the altered $PATH variable. And because any programs you run from a bash prompt are called by bash, the new path is in force for anything you run from the bash prompt.

The bottom line is that to add a new directory to the path, you must append or prepend the directory to the $PATH environment variable within a script included in the shell, and you must export the $PATH environnment variable. The only remaining question is: In which script do you place those two lines of code?

Source :

Social Bookmark These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Faves
  • LinkedIn
  • MisterWong
  • MySpace
  • Reddit
  • Technorati
  • Wikio
  • YahooBuzz
  • Ask
  • Google Bookmarks
  • Linkarena
  • Live-MSN
  • Newstube
  • seekXL
  • TwitThis
  • Webnews
  • Webride
  • Wikio DE
  • Y!GG
  • YahooMyWeb

Topics: LINUX | No Comments »

Trackback URL for this post: http://www.bearparc.info/2009/11/04/linux-adding-a-directory-to-the-path/trackback/

Comments

You must be logged in to post a comment.