Last active
May 18, 2017 09:28
-
-
Save shov/e7169839935b6a15682b25cae761a1f2 to your computer and use it in GitHub Desktop.
Remove \r in all .sh in the current directory used tr
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 | |
function movement() { | |
local bname=$(basename "$1") | |
local fbname=${bname%.*} | |
mv "$1" "${fbname}" | |
} | |
find . -name '*.sh' -exec sh -c 'tr -d "\r" < "$0" > "$0.tmp"' '{}' \; | |
find . -name "*.sh.tmp" | while read file; do movement "$file"; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment