Magellan Linux

Contents of /alx-src/branches/alxconf-060/functions/common.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2142 - (show annotations) (download) (as text)
Tue May 17 10:52:25 2011 UTC (12 years, 11 months ago) by niro
File MIME type: application/x-sh
File size: 604 byte(s)
-added rc_mecho() function
1 # $Id$
2
3 addconfig()
4 {
5 local opts
6
7 if [[ -z ${CONFIG} ]]
8 then
9 echo "You must define \$CONFIG varibale first!"
10 return 1
11 fi
12
13 if [[ ! -d $(dirname ${CONFIG}) ]]
14 then
15 install -d $(dirname ${CONFIG})
16 fi
17
18 # check for opts
19 case $1 in
20 -n) shift; opts=" -n" ;;
21 -e) shift; opts=" -e" ;;
22 esac
23
24 echo ${opts} "$@" >> ${CONFIG}
25 }
26
27 clearconfig()
28 {
29 if [[ -z ${CONFIG} ]]
30 then
31 echo "You must define \$CONFIG varibale first!"
32 return 1
33 fi
34
35 if [[ ! -d $(dirname ${CONFIG}) ]]
36 then
37 install -d $(dirname ${CONFIG})
38 fi
39 : > ${CONFIG}
40 }
41
42 rc_mecho()
43 {
44 rc_echo -e "${COLMAGENTA}$@${COLDEFAULT}"
45 }