Bashexit code > 0
Bad substitution
$bash: ${var//search/replace}: bad substitution
Analysis
You are trying to use a parameter expansion feature that
sh (or an older bash version) doesn't support.Common Triggers
- ●Running a bash script with
sh script.shinstead ofbash script.sh. - ●Using Bash 4.x features in an older shell.
Debug Checks
- $Check the shebang line (
#!/bin/bash). - $Check how you are invoking the script.
Resolution
1
Run explicitly with
bash.2
Change the script to be POSIX compliant if it must run in
sh.Metadata
- Tool
- Bash
- Severity
- High
- Tags
- #bash#syntax#variable