我有一个代码:
od -An -t x1 <"$file" |
while read line;do
for char in $line;do
if [ $needspace -eq 0 ]
then
export hexs=$hexs`printf "%.2s" "$char"`
needspace=1
else
export hexs=$hexs`printf "%.2s " "$char"`
needspace=0
fi
if [ `printf "%d" "0x$char" ` -lt 32 ] || [ `printf "%d" "0x$char"` -gt 126 ]
then
text=$text.
else
text=$text`echo -e "\x$char"`
fi
charsnow=$(($charsnow+1))
done
sup=1
echo $sup
done
echo $sup
问题是:首先echo $sup
写 1
但第二echo $sup
什么也没写。为什么我不能从“while”中获取$sup?
您有一个子 shell,因此不会发生副作用。http://mywiki.wooledge.org/BashFAQ/024
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)