1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-25 12:33:29 +01:00
php-phpbb/phpBB/develop/fix_files.sh
Nils Adermann 926d0f980e fix_files script must have been broken by svn:eol-style quite a while ago, now uses tr rather than sed to replace carriage returns
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10464 89ea8834-ac86-4346-8a33-228a782c2dd0
2010-01-31 21:50:10 +00:00

30 lines
833 B
Bash
Executable File

#!/bin/bash
#
# Remove all those annoying ^M characters that Winblows editor's like to add
# from all files in the current directory and all subdirectories.
#
# Written by: Jonathan Haase.
#
# UPDATE: 7/31/2001: fix so that it doesn't touch things in the images directory
#
# UPDATE: 12/15/2003: Fix so that it doesn't touch any "non-text" files
#
find . > FILELIST.$$
grep -sv FILELIST FILELIST.$$ > FILELIST2.$$
grep -sv $(basename $0) FILELIST2.$$ > FILELIST.$$
grep -sv "^\.$" FILELIST.$$ > FILELIST2.$$
file -f FILELIST2.$$ |grep text | sed -e 's/^\([^\:]*\)\:.*$/\1/' > FILELIST
file -f FILELIST2.$$ |grep -sv text | sed -e 's/^\([^\:]*\)\:.*$/Not Modifying file: \1/'
rm FILELIST2.$$
rm FILELIST.$$
for i in $(cat FILELIST); do
if [ -f $i ]; then
cat $i | tr -d '\r' > $i.tmp
mv $i.tmp $i
fi
done
rm FILELIST