Reputation: 5
I keep getting a 'bad substitution' error in my bash script at the point ${basename $option} where '$option' is input later in the script, does anyone know how to fix it?
function findByExtension {
strip=${basename $option}
extension="${strip##*.}"
}
I have also included '#!/bin/bash' at the start of the script.
Upvotes: 0
Views: 2516
Reputation: 798646
You want to perform command substitution there, not parameter substitution.
strip="$(basename "$option")"
Upvotes: 2