Created
May 8, 2014 19:48
-
-
Save jonpryor/b44439f7f01ad2af73c0 to your computer and use it in GitHub Desktop.
Demonstrate bash dynamic scoping
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
start: str=begin | |
inner: str=outer | |
end: str=begin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
str="begin" | |
echo "start: str=$str" | |
function inner { | |
echo "inner: str=$str" | |
} | |
function outer { | |
local str="outer" | |
inner | |
} | |
outer | |
echo "end: str=$str" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment