Beginner shell, reads variables from environment-variable-mac.ini files and writes them to a file in js format.

environment-variable-mac.ini file

UNIVER_USER_LOGIN="http://127.0.0.1/api/login"
UNIVER_SEARCH_ORDINARY="http://127.0.0.1/api/search/common"
UNIVER_SEARCH_LABEL="http://127.0.0.1/api/search/common"
UNIVER_SEARCH_VIDEO="http://127.0.0.1/api/search/common"
UNIVER_TASK_MANAGER="http://127.0.0.1/api/task/manager"
UNIVER_PROJECR_URL="67.110.220.11"
UNIVER_PROJECR_PORT=777778888

how can it be realized?

Apr.09,2021

use the awk command

awk -F '=' 'BEGIN {print "{"} {print "\t"$1":"$2","} END{print "}"}' environment-variable-mac.ini > environment-variable-mac.json
Menu