blob: 84d1b59a77b72af3c1c6d67492b5d007bc7fccff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#!/bin/bash
CWD=`pwd`
program=`basename $0`
usage() {
cat << EOF
Usage: $program [options]
Options:
-h,--help Display this message.
EOF
}
if [ -f "${CWD}/Makefile" ] ; then
make distclean
fi
gitignore='.gitignore'
while read ln; do
line=`echo "${ln}" | sed 's,^[ \t],,' | sed 's,[ \t]$,,'`
if [ "x$line" != "x" -a "${line:0:1}" != "#" ] ; then
if `echo "${line}" | grep -q '\*~$'` ; then
find "`dirname "${line}"`" -type f -iname '*~' -print0 | while IFS= read -r -d '' file ; do
rm -f "$file"
done
elif `echo "${line}" | grep -q '\*'` ; then
find "`dirname "${line}"`" -type f -iname "`basename "${line}"`" -print0 | while IFS= read -r -d '' file ; do
rm -f "$file"
done
else
if [ -d "${line}" ] ; then rm -rf "${line}" ; fi
if [ -f "${line}" ] ; then rm -f "${line}" ; fi
fi
fi
done < ${CWD}/${gitignore}
|