Skip to content

Instantly share code, notes, and snippets.

@nvgoldin
Created April 23, 2017 08:48
Show Gist options
  • Save nvgoldin/7049f34fecf56545e91f6f0d0681432c to your computer and use it in GitHub Desktop.
Save nvgoldin/7049f34fecf56545e91f6f0d0681432c to your computer and use it in GitHub Desktop.
inspect whether a variable declared with 'local' is local
#!/bin/bash -ex
a="global"
b="global"
c="global"
d="global"
function koko() {
local a b c d
a="xxx"
b="zzz"
c="ddd"
local
}
koko
./inspect_local.sh
+ a=global
+ b=global
+ c=global
+ d=global
+ koko
+ local a b c d
+ a=xxx
+ b=zzz
+ c=ddd
+ local
a=xxx
b=zzz
c=ddd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment