...
)
Minor changes like renaming a variable skips the problem. It seems that the parser gets confused in some cases.
Repeat-By:
Run the script bellow. The first block work. If I change the b name to bb, it fails! If I switch from $() to ``, it works:
A=$(
for b; do
case c in
d)
echo 123
;;
esac
done
)
echo OK
# Changed $() to ``
A=`
for bb; do
case c in
d)
echo 123
;;
esac
done
`
echo OK
# changed the name from b to bb!!
A=$(
for bb; do
case c in
d) #<- something with this
echo 123 #<- and this runs!! check stdout!
;;
esac
done
)
echo Fail
OUTPUT:
OK
OK
a.sh: command substitution: line 33: syntax error: unexpected end of file
123
a.sh: line 30: syntax error near unexpected token `;;'
a.sh: line 30: ` ;;'
--
Luiz Angelo