Usually, I see questions that people cannot access variables from outside their scope. However, I seem to be experiencing the opposite: I see variables still having values from the inner areas that they should have left after that. For example (creating svn aliases similar to git aliases ):
function svn() {
case $@ in
alias*) shift 1;
for i in "$@"; do
if [[ "$i" == "-t" ]];
then
j="$i,$j"
elif [[ "$i" == "-f" ]];
k="$i,$j"
fi
done
echo "i = $i"
echo "j = $j"
echo "k = $k"
;;
esac
}
script , bash ( ). "-t" "-f", , "$ i", "$ j" "$ k" script , script. Ubuntu 15.04, Ctrl-X Ctrl-V, GNU bash, 4.3.30 (1) -release (x86_64-pc-linux-gnu).
, bash, , ( , ). script ( ), export, . ?