I want to make a script /bin/sh compatible. At some point I was using a print-out of a hex variable to its decimal value but it is throwing this error:
sh: 1: arithmetic expression: expecting EOF: "16#c0"
That error is not present when the script is executed by /bin/bash. I boiled it down to the following problem:
$ sh -c 'echo $((16#c0))'
sh: 1: arithmetic expression: expecting EOF: "16#c0"
$ sh -c "echo $((16#c0))"
192
Why is that and how can I get echo working in my script?
EDIT: subshell is redirected to /bin/dash
$ readlink -f $(which sh)
/bin/dash
$ type sh
sh is /bin/sh