Last active
August 29, 2015 14:24
-
-
Save mattintosh4/a202593141353a3da420 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/bash | |
func(){ | |
# var を表示 | |
declare -p LINENO var | |
# var に 2 を代入 | |
var=2 | |
# var を表示 | |
declare -p LINENO var | |
} | |
# var に 1 を代入 | |
var=1 | |
# var を表示 | |
declare -p LINENO var | |
# 関数 func を実行 | |
func | |
# var を表示 | |
declare -p LINENO var |
This file contains hidden or 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
declare -i LINENO="18" | |
declare -- var="1" | |
declare -i LINENO="5" | |
declare -- var="1" | |
declare -i LINENO="11" | |
declare -- var="2" | |
declare -i LINENO="24" | |
declare -- var="2" |
This file contains hidden or 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
#!/bin/bash | |
func(){ | |
# var を表示 | |
declare -p LINENO var | |
# var をローカルとして 2 を代入 | |
local var=2 | |
# var を表示 | |
declare -p LINENO var | |
} | |
# var に 1 を代入 | |
var=1 | |
# var を表示 | |
declare -p LINENO var | |
# 関数 func を実行 | |
func | |
# var を表示 | |
declare -p LINENO var |
This file contains hidden or 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
declare -i LINENO="18" | |
declare -- var="1" | |
declare -i LINENO="5" | |
declare -- var="1" | |
declare -i LINENO="11" | |
declare -- var="2" | |
declare -i LINENO="24" | |
declare -- var="1" |
This file contains hidden or 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
#!/bin/bash | |
b=0 | |
for a in 1 | |
do | |
b=2 | |
done | |
declare -p a b | |
d=0 | |
for ((c = 1;;)) | |
do | |
d=2 | |
break | |
done | |
declare -p c d | |
e=0 | |
while : | |
do | |
e=1 | |
break | |
done | |
declare -p e | |
g=0 | |
while read f | |
do | |
g=2 | |
done <<<"1" | |
declare -p f g | |
i=0 | |
while read h | |
do | |
i=2 | |
break | |
done <<<"1" | |
declare -p h i |
This file contains hidden or 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
declare -- a="1" | |
declare -- b="2" | |
declare -- c="1" | |
declare -- d="2" | |
declare -- e="1" | |
declare -- f="" | |
declare -- g="2" | |
declare -- h="1" | |
declare -- i="2" |
This file contains hidden or 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
#!/bin/bash | |
var1=1 | |
: | var2=2 | |
(var3=3) | |
declare -p var1 var2 var3 |
This file contains hidden or 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
declare -- var1="1" | |
gistfile7.sh: line 5: declare: var2: not found | |
gistfile7.sh: line 5: declare: var3: not found |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment