I have some paths like so:
/dir
/dir//
/dir///
/path/to/dir
/path/to/dir/
/path/to/dir///
/path/to/dir/////////
I want to make it clearer using bash. I want to remove all /
characters at the end of path and having:
/path/to/dir
or /dir
without /
at the end.
This might be a possible solution:
sed -e 's/[/]*$//g'
For instance:
echo '/path/to/dir/////////' | sed -e 's/[/]*$//g'
gives you:
/path/to/dir