-
Notifications
You must be signed in to change notification settings - Fork 31
/
defs.sh
47 lines (39 loc) · 872 Bytes
/
defs.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
42
43
44
45
46
47
# ----------------------------------------------------------------------
# defs.sh: definitions common to all subdirectories
# ----------------------------------------------------------------------
# Users of this file should set LEVEL first
if test -z "$LEVEL"; then
export LEVEL=.
fi
export LEVEL=`cd $LEVEL; echo $PWD`
redo-ifchange $LEVEL/defs.sh $LEVEL/version.sh
# Pick up the FPP version
. $LEVEL/version.sh
# Echo args to stderr
echoerr()
{
echo $@ 1>&2
}
# Do command on all files matching regex
doall()
{
if ! test "$#" = 2; then
echoerr 'usage: doall command regex'
return 1
fi
for file in `find . -mindepth 1 -maxdepth 1 -name "$2"`; do
$1 $file
done
}
# Split path into dir and base
split()
{
export dir=`dirname $2`
export base=`basename $2`
}
# Remove temporary files
rm_tmp()
{
doall rm '*~'
doall rm '*redo*tmp'
}