Hi
I was making a little BASH-script to export a MDS domain and during that process I needed to get the name of the virtual system, to parse into vsx_provisioning_tool, so I could get all the interfaces out in a text-file.
At first I tried defining the VS_NAME variable as, based on the MDS-Domain name, which I feed manually into the script, along with username and password:
VS_NAME=`mgmt_cli show gateways-and-servers limit 400 -u $MDS_USER -p $MDS_PASS | grep -B4 "$MDS_DOMAIN" | grep -B1 '"CpmiVsClusterNetobj"'| grep 'name: ' | awk -F: '{ print $2 }' | sed 's/"//g' | tr -d ' '`
Looking at the variable with echo, everything seems fine:
[Expert@MDS_server:0]# echo $VS_NAME
vs-MigrTestSite
But the vsx_provisioning_tool command fails:
[Expert@30000vmCPMGT04:0]# vsx_provisioning_tool -s $CMA_IP -u $MDS_USER -p $MDS_PASS -o show vd name $VS_NAME
Version ignis_main, build 996000085
not found in database.stSite
Trying to figure out what went wrong, I simply tried to execute the variable directly:
[Expert@MDS_server:0]# $VS_NAME
-bash: $'vs-MigrTestSite\r': command not found
Main question:
Why is there suddenly both $, ' and \r in the variable?
I did a workaround by setting the variable "manually", by feeding the vs-name into the script like I do with the domain-name. Then the variable is just fine.