forked from aqbanking/gwenhywfar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgwenspell.sh
executable file
·41 lines (41 loc) · 1.04 KB
/
gwenspell.sh
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
41
#!/bin/bash
# written by Thomas Viehmann, with a slight modification by Martin Preuss
#
set -e
# run in top source dir to correct the misspelling
if [ "$1" == "content" ] && [ "$2" != "" ] ; then
AFILE=$2
case "$AFILE" in
*gwenspell.sh)
;;
*~)
;;
*.o)
;;
*.lo)
;;
*.la)
;;
*)
echo "Processing content:" ${AFILE}
sed 's/gwenhyfwar/gwenhywfar/g' < "${AFILE}" > "${AFILE}.gwenspell.tmp" &&
mv "${AFILE}.gwenspell.tmp" "${AFILE}"
;;
esac
elif [ "$1" == "filename" ] && [ "$2" != "" ] ; then
AFILE=$2
DESTFILE=$(echo ${AFILE} | sed 's/gwenhyfwar/gwenhywfar/g' )
if [ ${DESTFILE} != ${AFILE} ] ; then
echo "Moving:" $2
mv -i $AFILE $DESTFILE ;
fi
elif [ "$1" == "" ] ; then
SELF=${PWD}/$0
echo "Checking filenames..."
find -name \*gwenhyfwar\* -and -exec ${SELF} filename '{}' ';'
echo "Checking file contents..."
find -type f -and -exec grep -q gwenhyfwar '{}' ';' -and -exec ${SELF} content '{}' ';'
else
echo "Use without argument to start..."
exit 1
fi