Reputation: 125
I am writing a shell script where path can be ~/as-NY/com or ~/as-LN/com whatever is available. I can achieve this in K-shell as
~/as-NY/com
~/as-LN/com
cd ~/as-(NY|LN)/com, but not sure about bash. Can someone help here
cd ~/as-(NY|LN)/com
Upvotes: 2
Views: 43
Reputation: 784868
In BASH you need to enable extglob and do it like this:
extglob
shopt -s extglob cd ~/as-@(NY|LN)/com