Created
April 3, 2016 21:58
-
-
Save corytodd/2c945c7b67ab08aae139f90dfdae3619 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/sh | |
# Makefile fixer | |
# Some old projects that have been touched by dumb text editors | |
# may have had their makefile tabs turned in spaces. For large | |
# projects, this is a pia to fix. Use this script in your project | |
# directory as a quick fix. +1 for the expand command. | |
set -e | |
old="$1" | |
new="$2" | |
echo "Replacing leading Makefile spaces with 1 hard tab ..." | |
count=0 | |
for file in $(find . -name 'Makefile'); do | |
if [ -f $file ] && [ -w $file ]; then | |
echo "Fixing $file" | |
unexpand --first-only "$file" | |
count=$((count+1)) | |
fi | |
done | |
echo "Updated $count files" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment