Created
December 2, 2011 12:12
-
-
Save youngbrioche/1423033 to your computer and use it in GitHub Desktop.
Add encoding headers to Ruby files
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
find -name "*.rb" | \ | |
while read filepath; do \ | |
{ echo -n "$filepath: "; head -n1 "$filepath"; } | \ | |
grep -v encoding | sed -e "s#.*#$filepath#"; \ | |
done | \ | |
while read filepath; do \ | |
{ echo "# encoding: UTF-8"; echo; } | \ | |
cat - "$filepath" > "$filepath.tmp"; \ | |
mv "$filepath.tmp" "$filepath"; \ | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment