Issue
I have a line in a script that works in zsh but does not work in bash:
SHORTDIR=${${${PWD##*/}//./_dot_}//:/_colon_}
This is basically a short/efficient version of basename $PWD | sed -e 's/\./0/g' -e 's/:/1/g'
.
What's the syntax for stringing together variable expansions?
Solution
Sadly, the first part of the substitution has to be a parameter name. An alternative sed version would be:
echo $PWD | sed -e 's!.*/!!' -e 'y/.:/01/'
Answered By - perreal