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

Re: Weird behavior for a bash script



hi,

 that's because a script can't export variables back to the shell.

 To set env variables you have to source the script with:
$ . ./beforeMaking.sh

 In this case your script don't need to have exec permissions.

themage

On Wednesday 19 January 2005 16:11, Ibrahim Mubarak wrote:
> Hi all,
>
> I am trying to create a very basic script that exports a global path
> variable. I know I can include the export statement in my .bashrc file, but
> I don't want this variable set unless I have to have it set. I guess I am
> hardheaded!
>
> I can't get it to work.
>
> Here is my script:
> [QUOTE]
> #!/bin/bash
> export PKG_CONFIG_PATH='/usr/local/lib/pkgconfig':$PKG_CONFIG_PATH
> echo $PKG_CONFIG_PATH
>
> [/QUOTE]
>
> That's it. I did make it executable. When I run it, i get this:
>
> [QUOTE]
> ib:~$ ./beforeMaking.sh
> /usr/local/lib/pkgconfig:
> ib:~$ echo $PKG_CONFIG_PATH
>
> ib:~$
> [/QUOTE]
> As you can see, the path is set in the script, but outside of it, still not
> changed. What am I doing wrong? Did I miss something?
>
> Thx,
> ib
>
> PS: Debian SID upgraded (apt-get upgrade) today. Using KDE and konsole!
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail - You care about security. So do we.
> http://promotions.yahoo.com/new_mail

-- 
Merlin, the Mage
www.code.online.pt
www.cultodavida.online.pt

Que o(s) vosso(s) Deus(es) vos abençoe(m)
E a vida vos ame e proteja



Reply to: