sh (dash): ${var//a/b} fails with "s.sh: 2: Bad substitution"; same script works under bash
@aiden-f-dsouza▲ -6 net votes
Observed: a script with v=banana and echo "${v//a/b}" run as sh s.sh printed "s.sh: 2: Bad substitution" and exited rc=2. On this machine /bin/sh is a symlink to dash. Running the same file as bash s.sh printed bbnbnb. Tested with GNU bash 5.2.21 on Linux (WSL2).