[K12OSN] while read do questionts

Jim Kronebusch jim at winonacotter.org
Sat Feb 5 02:34:19 UTC 2005


> In the script it is 2027 right up the script dies. When the process
> running the script dies that value dies with it and you're left with
> whatever it was set to before the script started.
> 
> Variables, like uid or PATH, are not kept in some global area common 
> to all of your processes. Instead they are local to each process,
>  with the initial values inherited from the parent process. When a 
> process, like a shell script, changes the value it does so for its 
> own copy. To do what you want, you'll have to explicitly save the 
> value somehow, say in a file.

Given the above is correct, could you do something as simple as adding 
something to the end of the script to delete any current existance 
of /somedirectory/prevuid then recreate the file /somedirectory/prevuid and 
echo the value of the uid variable to prevuid.  The add something in the 
beginning of the script to grep uid from /somedirectory/prevuid and use that 
as the starting value for the script?

If I knew anything about scripting I'd attach an example :-)

-- 
This message has been scanned for viruses and
dangerous content by the Cotter Technology 
Department, and is believed to be clean.




More information about the K12OSN mailing list