What shell do you guys use? - BSD
Users browsing this thread: 25 Guest(s)
|
|||
(02-10-2020, 06:56 AM)venam Wrote:(02-10-2020, 06:54 AM)injinj Wrote: The closure variable i is incremented after every invocation of hello, but if hello in a subprocess, then i doesn't change: I could run the same echo command 100 times and it will still print 3 4 5. The reason is that the shell environment is forked, and then hello is run 3 times. I can capture this with ps like this: Code: ; echo `{ps ax | grep desh > ps.out; hello ; hello ; hello} ; cat ps.out The 5205 process is the desh running in the terminal connected to pts/0, the 17xxx process are subshells spawned using the backquote operator, these are running the hello functions. |
|||