Novice shell, I want to read the variables in the environment-variable-mac.ini file and the templates in the setting.js, and then put both the variables and the setting.ini file in a newly generated setting.js file, both of which are in the configuration directory
environment-variable-mac.ini
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
setting.ini
/**
* environment
*
*
*/
var ENV = (function(){
return {
pythonAPI: {
userLogin : "$UNIVER_USER_LOGIN",
video: "", //
searchOrdinary: "$UNIVER_USER_LOGIN,
searchLabel: "$UNIVER_USER_LOGIN",
searchVideo : "$UNIVER_USER_LOGIN",
taskManager: "UNIVER_TASK_MANAGER",
domainName: "UNIVER_PROJECR_PORT", //
domainPort: $UNIVER_USER_LOGIN
}
}
})();
I want the content in my setting.js file to be like this
/**
* environment
*
*
*/
var ENV = (function(){
return {
pythonAPI: {
userLogin : "http://127.0.0.1/api/login",
video: "", //
searchOrdinary: "http://127.0.0.1/api/search/common", //
searchLabel: "http://127.0.0.1/api/search/common",
searchVideo : "http://127.0.0.1/api/search/common", //
taskManager: "http://127.0.0.1/api/task/manager", //
domainName: "67.110.220.11", //
domainPort: 777778888//
}
}
})();
my script goes like this
-sharp!/bin/bash
awk -F "=" "BEGIN {print "{"} {print "\t"$1":"$2","} END{print "}"}" environment-variable-mac.ini > setting.js
awk -F "=" "BEGIN {print "{"} {print "\t"$1":"$2","} END{print "}"}" setting.ini > setting.js
but cannot generate the file I want