Não é possível obter o valor da variável fora do WHILE em BASH
Eu tenho um código:
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
O problema é: primeiroecho $sup
escreve 1 mas segundoecho $sup
não escreve nada. Por que não consigo tirar $ sup de "while"?