-
-
Save jnorrid/f223b02e81aad953692cf8bdef4ff1d0 to your computer and use it in GitHub Desktop.
Convert whitespace from tabs to 2 spaces
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 | |
set -e # fail on nonzero status | |
cd $1 | |
files=`find . \ | |
-not \( -path ./vendor -prune \) \ | |
-not \( -path ./tmp -prune \) \ | |
-name '*.html' -o -name '*.js' -o -name '*.coffee' -o \ | |
-name '*.sass' -o -name '*.scss' -o -name '*.erb' \ | |
-type f` | |
# Handle whitespace in filenames | |
# http://en.wikipedia.org/wiki/Internal_field_separator | |
IFS=$'\n' | |
for file in $files; do | |
echo -n "Converting '$file' ... " | |
expand -t2 "$file" > out.tmp | |
mv out.tmp "$file" | |
echo 'done.' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment