One-shot parsing.
This commit is contained in:
parent
8d903860c4
commit
ab0e7c77d9
1 changed files with 13 additions and 20 deletions
33
fetch_fio.sh
33
fetch_fio.sh
|
@ -61,26 +61,19 @@ while ! [ -z "$1" ] ; do
|
||||||
done
|
done
|
||||||
|
|
||||||
# Configuration parsing
|
# Configuration parsing
|
||||||
cat "$CONFIG_FILE" \
|
get_config_value() {
|
||||||
| sed 's/#.*//' \
|
if [ -z "$1" ] ; then
|
||||||
| while read line ; do
|
echo "get_config_value() requires parameter name"
|
||||||
name=${line%% *}
|
exit 1
|
||||||
value=${line#* }
|
fi
|
||||||
echo ===
|
cat "$CONFIG_FILE" \
|
||||||
echo $line
|
| sed 's/#.*//' \
|
||||||
echo $name
|
| sed 's/^[ \t]*//' \
|
||||||
echo $value
|
| grep "^$1" \
|
||||||
case "$name" in
|
| sed 's/^[^ \t]*//'
|
||||||
apikeys-file)
|
}
|
||||||
echo "APIKEYS"
|
CFG_BANK_DIR=`get_config_value bank-dir`
|
||||||
CFG_APIKEYS_FILE="$value"
|
CFG_APIKEYS_FILE=`get_config_value apikeys-file`
|
||||||
;;
|
|
||||||
bank-dir)
|
|
||||||
echo "BANK_DIR"
|
|
||||||
CFG_BANK_DIR="$value"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
# Configuration merging
|
# Configuration merging
|
||||||
if [ -z "$ARG_BANK_DIR" ] ; then
|
if [ -z "$ARG_BANK_DIR" ] ; then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue