[Nottingham] Bash Variables
Dan Mackdermott
dan at inputlink.net
Fri Aug 1 14:44:59 BST 2008
Hi Mike,
Mike Haber wrote:
> When using bash and exporting variables, is there a way of listing the
> previous values that a variable contained?
The safest thing to do is to save a copy of the variable before it gets
changed.
> For example if a script is run that contains 'export foo=bar' can the
> previous values for $foo be accessed after the script has run?
After the execution of the script, the shell that the script was running
under terminates and any variables are unset.
However if you want to gain access to variables from the parent process
whilst the script is running, you could do some jiggery pokery with the
$PPID which is the parent process id and 'ps -exwww' which will report
environment variables from different processes.
I know it's not a complete solution but it's a start...
Cheers,
Dan
--
Dan Mackdermott RHCE (Director)
InputLink Consulting Ltd
http://www.inputlink.net
t: +44 (0)115 988 1700
m: +44 (0)7980 711 557
Registered in England: 04487463
More information about the Nottingham
mailing list