[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Weird behavior for a bash script



On Wed, 19 Jan 2005 08:11:27 -0800 (PST), Ibrahim Mubarak
<ibmub80@yahoo.com> wrote:
> ib:~$ ./beforeMaking.sh
> /usr/local/lib/pkgconfig:
> ib:~$ echo $PKG_CONFIG_PATH
> 
> ib:~$

I don't think you can export a variable to a parent process.  That is,
a script can't set the environment for the shell that calls it. 
That's why bash has the "." builtin.  Try
$ . ./beforeMaking.sh
instead.  You don't need the "#!/bin/bash" line, or for the file to be
executable, since bash is just treating the file as a series of
commands to execute, not a separate process.

-- 
Michael A. Marsh
http://www.umiacs.umd.edu/~mmarsh



Reply to: