4 ms·
You quote it like this: parent_dir="$(basename "$dir")" Quotes are syntactic in bash, so it understands that the outer pair of quotes are surrounding the
by rossy 8y ago
You quote it like this:
parent_dir="$(basename "$dir")"
Quotes are syntactic in bash, so it understands that the outer pair of quotes are surrounding the command substitution and the inner pair are inside it. This will work regardless of any spaces or special characters in $dir.