# this increments x x=1 echo "$((x++)), x is $x" echo x is correct: $x echo '=========' # but this doesn't change x outside the pipeline x=1 echo "$((x++)), x is $x" | cat echo x is still: $x echo '=========' # same thing with non-arithmetic assignments ${name::=value} # this works x=1 echo "${x::=2}, x is $x" echo x is correct: $x echo '=========' # but this doesn't x=1 echo "${x::=2}, x is $x" | cat echo x is still: $x echo '=========' x=1 echo $(echo "$((x++)), x is $x") echo x is still: $x echo '=========' x=1 <<<"$((x++)), x is $x" echo x is still: $x echo '=========' x=1 cat <<<"$((x++))" echo x is still: $x echo '=========' x=1 <