stronger parsing

This commit is contained in:
Serghey Rodin 2012-02-15 14:00:06 +02:00
commit b2a6871c39
2 changed files with 3 additions and 3 deletions

View file

@ -12,7 +12,7 @@
# Argument defenition
key=$(echo "$1" | tr '[:lower:]' '[:upper:]' )
value=${2// /%spc%}
value=$2
# Importing variables
source $VESTA/conf/vars.conf

View file

@ -19,12 +19,12 @@ source $VESTA/conf/vars.conf
json_list_conf() {
lines=$(wc -l $V_CONF/vesta.conf | cut -f 1 -d ' ')
i='0'
IFS=$'\n'
echo -e "{\n\t\"config\": {"
for str in $(cat $V_CONF/vesta.conf); do
(( ++i))
key=${str%%=*}
value=${str#*=}
value=${value//%spc%/ }
if [ "$i" -lt "$lines" ]; then
echo -e "\t\t\"$key\": \"${value//\'/}\","
else
@ -36,10 +36,10 @@ json_list_conf() {
# Shell function
shell_list_conf() {
IFS=$'\n'
for str in $(cat $V_CONF/vesta.conf); do
key=${str%%=*}
value=${str#*=}
value=${value//%spc%/ }
echo "$key: ${value//\'/}"
done
}