[K12OSN] while read do questionts

cliebow at downeast.net cliebow at downeast.net
Sat Feb 5 02:00:15 UTC 2005


yeah: i kinda thought as much..thanks for the comeback..this is one piece
of a much larger smblda script..chuck

> On Fri, 2005-02-04 at 07:06, cliebow at downeast.net wrote:
> [...]
> > echo "uid: $name"
> > echo "uidNumber: $uid"
> 
> Presumeably, uid is set before the script is called since it is not
> initialized before it is first used.
> 
> [...]
> > let "uid +=1"
> > done
> > 
> > ok coders: can you get me round this stupid brain-flattulence. run 2000
> > users thru this piece of script and uid increments on each pass.so at end
> > of script uid otter be 2027 or summat..
> 
> 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.
> 
> 
> _______________________________________________
> K12OSN mailing list
> K12OSN at redhat.com
> https://www.redhat.com/mailman/listinfo/k12osn
> For more info see <http://www.k12os.org>
> 


---------------------------------------------
This message was sent from Downeast.Net.
http://ellsworthme.com/





More information about the K12OSN mailing list