In bash I have the following code:
a='and/or fox-----'
a=${a//[\/\_ ]/-}
a=${a//-+$/ }
echo $a
With the 3rd line I want to replace the trailing '-' with an empty string, and I know in some contexts the +$ means "one or more at the end of the string". However, the result I'm getting is and-or-fox-----. Does anyone know how to get a to be and-or-fox?
 
     
     
     
    