Annotation of /alx-src/branches/alxconf-060/functions/common.sh
Parent Directory | Revision Log
Revision 2142 -
(hide annotations)
(download)
(as text)
Tue May 17 10:52:25 2011 UTC (13 years, 4 months ago) by niro
File MIME type: application/x-sh
File size: 604 byte(s)
Tue May 17 10:52:25 2011 UTC (13 years, 4 months ago) by niro
File MIME type: application/x-sh
File size: 604 byte(s)
-added rc_mecho() function
1 | niro | 2032 | # $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 | niro | 2142 | |
42 | rc_mecho() | ||
43 | { | ||
44 | rc_echo -e "${COLMAGENTA}$@${COLDEFAULT}" | ||
45 | } |