24 lines
603 B
Bash
24 lines
603 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
slashes=$(sed 's/\([\/\\]\)/\1/g' <<< "$1")
|
||
|
while [ -n "$slashes" ]; do
|
||
|
slash=$(cut -c1 <<< "$slashes")
|
||
|
case "$slash" in
|
||
|
" ")
|
||
|
slashes=$(cut -c2- <<< "$slashes");
|
||
|
if [ "$(cut -c1 <<< "$slashes")" != "/" ]; then
|
||
|
echo -n "$slash"
|
||
|
fi
|
||
|
;;
|
||
|
"/")
|
||
|
slashes=$(cut -c2- <<< "$slashes" | sed 's/ \([\\\/]\)/\1/g')
|
||
|
echo "$slash"
|
||
|
;;
|
||
|
"\\")
|
||
|
slashes=$(cut -c2- <<< "$slashes" | sed 's/\([\\\/]\)/ \1/g')
|
||
|
echo "$slash"
|
||
|
;;
|
||
|
esac
|
||
|
done
|
||
|
echo
|