Using variables during repository creation


(Vinod Rao) #1

Hi Team,

Can we use variables in repository setting for location setting. I am defing below but its not working.
$CURL -k -XPUT $DB_HTTP/$SHARD_DIR -d '{
"type": "fs",
"settings": {
"compress": true,
"location": "$BK_LOC/$SHARD_DIR"
}
}'

The variables are already declared during the script execution.


(Mark Walkom) #2

How is it not working? Are you getting more errors?
Have you tried using set -x to debug your script?


(Vinod Rao) #3

I am getting below when we run in debug mode:

Check the status of the repository
17:53
{
"director" : {
"type" : "fs",
"settings" : {
"compress" : "true",
"location" : "$BK_LOC/$SHARD_DIR"
}
}
}

in the locaton i am not getting path to store . Getting the variable as it is. How can we solve this.


(Mark Walkom) #4

Linking to your script would help.


(Vinod Rao) #5

Linking in the sense replacing $BK_LOC/$SHARD_DIR with acutal location ? or any other way we have ?


(Mark Walkom) #6

Show us your code.


(Magnus B├Ąck) #7

The problem is that your string is single quoted, and shell script variables aren't expanded within single quoted strings. Make them double quoted instead, and remember to escape the double quotes in the JSON payload.


(Vinod Rao) #8

Thank you magnusbaeck . Its working


(system) #9