You are running your script with sh
, which is not the same as bash
. It doesn't support this type of substitution.
Run your script with
bash script
or make sure it's executable (chmod u+x /path/to/script
) and run it directly
/path/to/script
If your current directory happens to be /path/to
, you can just type
./script