(solved,sry)
Heyas
I'd like to give a little preview of an existing conf file, but not showing comments or empty lines.
Sadly, either the output style is wrong, or not all values are printed.
My current issue is, that the first variable read (var) contains both, the first and the second (val) variable.
Content of: this.conf
one="some value"
# Comment
two=bool
GREP=\grep;SED=\sed;CONFIG=this.conf
$GREP -v ^"#" "$CONFIG"| \
$SED s,"="," ",g | \
while read -r var val;do
[ -n "$var" ] && printf '\r%s\t = \t%s\n' "$var" "$val"
done
But what i get is this:
one "some value" =
two bool =
Expected output:
one = "some value"
two = bool
In a previous i attempt, i had:
#touch $TMP.cfg
#printf "$($GREP -v '#' $CONFIG)" > $TMP.cfg
#while read var val;do
# [ ! "#" = "${var:0:1}" ] && \
# [ -n "$var" ] && \
# printf '\r%s\t = \t%s\n' "$var" "$val"
#done < $TMP.cfg
This had the output-stle as expected.
However, the last entry was not shown, and actualy i'm still trying to figure a 'for loop' for this.
Any ideas please?
EDIT:
Nevermind, should have used:
while IFS== read ....
EDIT2:
Doh, and this would have beein bash'ism, or so...
VARS=$(tui-conf-get -l "$CONFIG"|$GREP -v req)
#source "$CONFIG"
for var in $VARS;do
tui-echo "$var" "${!var}"
done