Reputation: 1220
I am building meteor application and installing this application in client's system via bash script in windows.
In this script, i need to get current directory path stored in variable and then i need to write it in settings.json file.
I tried many solutions but later i found out that all those were for batch script.
mkdir upload
cd upload
DB_IMG_PATH=cd // I need to set path here in any variable and later use it below to write in settings.json file
echo %DB_IMG_PATH%
cd ..
echo '{"public":{"imgUploadUrl":"D:/mssqlempowervisi/upload","adminUser":"[email protected]","adminPassword":"admin@123"}}' >> settings.json
Upvotes: 0
Views: 4759
Reputation: 1563
Assuming you're really in bash:
mkdir upload
cd upload
DB_IMG_PATH=$PWD
echo "$DB_IMG_PATH"
cd ..
echo '{"public":{"imgUploadUrl":"'"$DB_IMAGE_PATH"'","adminUser":"[email protected]","adminPassword":"admin@123"}}' >> settings.json
And the same thing without unnecessary cd steps:
mkdir upload
DB_IMG_PATH=$PWD/upload
echo "$DB_IMG_PATH"
Please be aware though:
cd $foo
is bad. cd "$foo" || exit
is good.Upvotes: 2