最佳答案
I'm trying to replace /./
or /././
or /./././
to /
only in bash script. I've managed to create regex for sed but it doesn't work.
variable="something/./././"
variable=$(echo $variable | sed "s/\/(\.\/)+/\//g")
echo $variable # this should output "something/"
When I tried to replace only /./
substring it worked with regex in sed \/\.\/
. Does sed regex requires more flags to use multiplication of substring with +
or *
?