30 lines
408 B
Bash
30 lines
408 B
Bash
#!/bin/bash
|
|
getConfig() {
|
|
while read key value
|
|
do
|
|
case $key in
|
|
'#'*)
|
|
#comment
|
|
;;
|
|
'')
|
|
#empty line
|
|
;;
|
|
'[general]')
|
|
context=General
|
|
;;
|
|
'[source]')
|
|
context=Source
|
|
;;
|
|
\[*\])
|
|
context=Destination
|
|
destination="${key#[}"
|
|
destination="${destination%]}"
|
|
destinations+=("${destination%]}")
|
|
;;
|
|
*)
|
|
getConfig$context
|
|
;;
|
|
esac
|
|
done < "$cffile"
|
|
}
|