LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Changing PATH on the fly in BASH scripts (https://www.linuxquestions.org/questions/programming-9/changing-path-on-the-fly-in-bash-scripts-66183/)

pioniere 06-17-2003 01:40 PM

Changing PATH on the fly in BASH scripts
 
I want to be able to add to my PATH when running a BASH shell script, but cannot get it to work. I have tried several different ways to achieve this from within a script, but none seem to work. I thought that (for example):

Code:

export PATH=${PATH}:~/bin
would work within the shell script, but it does not.

I have searched the forums and can find lots of information on how to set the PATH from within .profile, .bashrc, etc., but nothing on how to do it from within a 'normal' shell script.

If anyone could shed any light on this, I would appreciate it. Thanks.

Hko 06-17-2003 04:52 PM

Well, it does work on my computer, but I do remember having the same problem at one time. I can't get it to fail any more. Anyways, back then, I solved it this way:
Code:

export PATH=${PATH}:${HOME)/bin


All times are GMT -5. The time now is 06:01 AM.