2 # provides some general-purpose script functions
4 # Copyright (C) 2004 Eric Marchionni, Patrik Rayo
5 # Zuercher Hochschule Winterthur
7 # This program is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by the
9 # Free Software Foundation; either version 2 of the License, or (at your
10 # option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
12 # This program is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 # RCSID $Id: function.sh,v 1.3 2005/02/16 22:20:52 as Exp $
20 ############################################
21 # print output in color
25 echo -e
"\033\13301;31m$1\033\1330m"
29 echo -en
"\033\13301;31m$1\033\1330m"
33 #############################################
34 # output all args to stderr and exit with
43 #############################################
44 # search and replace strings throughout a
48 function searchandreplace
{
54 [ -d
"$DESTDIR" ] || die
"$DESTDIR is not a directory!"
57 #########################
58 # create a temporary file
64 ###########################################
65 # search and replace in each found file the
69 for eachfoundfile
in `find $DESTDIR -type f`
71 sed -e
"s/$SEARCHSTRING/$REPLACESTRING/g" "$eachfoundfile" > "$TMPFILE"
72 cp -f
"$TMPFILE" "$eachfoundfile"
76 ###########################
77 # delete the temporary file