In my script I'm retrieving a parameter through an API call. I need to trim some things out of the result so I can use it as a parameter to pass to another process. I've got it working but it's pretty kludgy and I'm hoping someone can help me with a better way.
This is the code that retrieves the parameter:
vmx=`/usr/lib/vmware-vcli/apps/vm/vminfo.pl --url https://"$1":443/sdk/webService --username "$esxiuser" --password "$esxipass" --vmname "$2" --fields vmPathName`
vmx1=[${vmx##*[}
vmx2=${vmx1% *}
And this is the result of vmx, vmx1, & vmx2:
vmx='vmPathName: [NFS1] lab-xp03/lab-xp03.vmx '
vmx1='[NFS1] lab-xp03/lab-xp03.vmx '
vmx2='[NFS1] lab-xp03/lab-xp03.vmx'
vmx2 is the result I need to pass on.
Thanks for taking a look!
h