From: wrichard AT direct DOT ca (Wade Richards) Subject: Re: .BASHRC-problem 21 Jan 1998 17:18:57 -0800 Message-ID: <00a601bd2571$791392e0$16faaecc.cygnus.gnu-win32@c4ftj> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit To: Cc: You have 2 problems here: 1) it doesn't keep the "export", and (2) it gets the path wrong. 1) You are executing your .bashrc file in a sub-shell. When you give the name of a shell script on the command line (you can tell it's a shell script by the #!), bash will execute the program specified in the #! line, feeding in the script file. So, the bash process that you are interacting with starts a NEW instance of bash to run your .bashrc file. This new, interactive one gets its env. changed by the export PATH statement, but it doesn't do anything to the interactive bash you are using. To fix this problem, use ". ~/,bashrc" (note the "." command). This tells the interactive bash to read the file provided (~/.bashrc), and execute all the commands in it. This way, the export PATH statement will affect the bash that you are interacting with. 2) I'm not quite sure where your //d/cygnus/b18/tcl/bin part came from. If I had to guess, I'd say that you have an /etc/profile file that does (among other things) "export PATH=$PATH://d/cygnus/b18/tcl/bin", since your /etc/profile file will be executed by any new shell that's created. You can verify this by running "bash -vx", and seeing what commands get executed as part of the bash startup process. --- Wade ---------- Wade Richards -= mailto:WRichard AT Direct DOT CA =- "Never attribute to malice what can adequately be explained by stupidity." -----Original Message----- From: Juha Jäykkä To: gnu-win32 Date: Saturday, January 17, 1998 10:54 Subject: .BASHRC-problem As this problem is not discussed in any of the www-help pages (that I could find) and I couldn't find it in archives too, I'd like to ask it here. I keep losing my environment variables I set within my .bashrc. A screenshot of the situation may clarify this. Here you go: --clip-- juhaj AT IO 18:20:22 /obj>echo $PATH /bin juhaj AT IO 18:20:26 /obj>cat ~/.bashrc #!/bin/sh.exe PATH=$PATH:/home/juhaj/bin export PATH echo Test: $PATH juhaj AT IO 18:20:35 /obj>~/.bashrc Test: /bin://d/cygnus/b18/tcl/bin:/home/juhaj/bin juhaj AT IO 18:20:42 /obj>echo $PATH /bin juhaj AT IO 18:20:47 /obj> --clip-- Obviously it does not "keep" the exported variable but it also sets it all wrong! Where did the "//d/cygnus/b18/tcl/bin:" part come from??? I am at a total loss here. When I export variables, they should always be global, am I right? Any ideas or fixes? [system: NT40, intel, b18, coolview, bash-2.01] -- ----------------------------------------------- | Juha Jäykkä, juolja AT utu DOT fi | | home: http://www.utu.fi/~juolja/ | | pgp-key: http://www.utu.fi/~juolja/pgp.txt | ----------------------------------------------- - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help". - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".