Skip to content

Instantly share code, notes, and snippets.

@jonpryor
Created May 8, 2014 19:48
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jonpryor/b44439f7f01ad2af73c0 to your computer and use it in GitHub Desktop.
Save jonpryor/b44439f7f01ad2af73c0 to your computer and use it in GitHub Desktop.
Demonstrate bash dynamic scoping
start: str=begin
inner: str=outer
end: str=begin
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