-
-
Save defHLT/259073e36e4d5d47d56c1a4a89cc48c7 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