Thread: Subshell
View Single Post
  #3   (View Single Post)  
Old 15th January 2016
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 1,027
Default

Two more critters for your menagerie

Code:
% uname -a
NetBSD hp.lan 7.99.25 NetBSD 7.99.25 (GENERIC.201601041220Z) #0: Mon Jan  4 14:54:30 UTC 2016  builds@b41.netbs\
d.org:/home/builds/ab/HEAD/i386/201601041220Z-obj/home/source/ab/HEAD/src/sys/arch/i386/compile/GENERIC i386

% . subshell.sh
setting a=1 ...
About to enter subshell ...
From within subshell the value of a : 1
Assigning 2 to a ...
From within subshell the value of a : 2
Working directory changed to /etc
Leaving subshell
Back home from trip to subshell ...
Value of a : 1
Working directory: /not/etc

================================================

% uname -a
SunOS redacted 5.10 Generic_150400-28 sun4v sparc sun4v

% . subshell.sh
setting a=1 ...
About to enter subshell ...
From within subshell the value of a : 1
Assigning 2 to a ...
From within subshell the value of a : 2
Working directory changed to /etc
Leaving subshell
Back home from trip to subshell ...
Value of a : 1
Working directory: /not/etc
Reply With Quote