I struggle to properly read a file which is nothing else than a key=value file.
This is the file:
#test.txt
global.project=99999
global.env=pr
global.app=Terraform
global.dcs=CloudBroker
global.cbp=n/a
This is the code:
TS=""
while IFS== read -r f1 f2; do
echo $f1
echo $f2
val=$f2
TS+="\"${f1}\":\"${f2}\","
done < "tags.txt"
echo "${TS}" # Result: ","global.cbp":"n/audBroker
The result is very strange. When I remove f2, then no issues occur.
The expected result should be:
"global.opco":"99999","global.env":"pr" and so on.