Hello

[EMAIL PROTECTED] (<[EMAIL PROTECTED]>) wrote:

> How do I write a script to set an environment variable?
> 
> I feel like I should know this. I want to set my PATH in pbuilder &
> the author suggested using an "A" hook. However, I can't create a hook
> - an executable - which sets an environment variable.
> 
> I tried:
> 
> #!/bin/sh
> export PATH=/usr/lib/ccache:$PATH
> 
> and just:
> 
> export PATH=/usr/lib/ccache:$PATH
> 
> but in either case, calling ./A10hook doesn't change my environment
> variable. I hope I'm just missing something foolishly obvious.

Yes. The script is run in a subshell, sets the variable, and when the
script is finished, the subshell terminates. You need to set the
variable in the current shell. Run

. ./A10hook

best regards
 Andreas Janssen

-- 
Andreas Janssen <[EMAIL PROTECTED]>
PGP-Key-ID: 0xDC801674 ICQ #17079270
Registered Linux User #267976
http://www.andreas-janssen.de/debian-tipps-sarge.html


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to