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

Re: Script to Set Environment Variable?



Incoming from ms419@freezone.co.uk:
> How do I write a script to set an environment variable?

Understand that you're trying to define something that will be
available to the current process, and all children of that process.
Already existing processes won't know about it, and after that process
exits, the newly defined value disappears.

> 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

#!/bin/sh
export PATH=/usr/lib/ccache:$PATH
now_run_something &     # <-- new value of PATH will be visible to this.

Also, consider:

   COLUMNS=120 dpkg -l

That defines a new value to COLUMNS for that one invocation of dpkg
only.  No export necessary, and the new definition disappears when
that dpkg process exits.


-- 
Any technology distinguishable from magic is insufficiently advanced.
(*)    http://www.spots.ab.ca/~keeling      Please don't Cc: me.
- -



Reply to: