Created
November 27, 2022 17:05
-
-
Save zoeisnowooze/9d302565748fe8535a25727892533b22 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment