I have to do the following from within a bash script. The /VMNFS/ folder is present on linux box, from where script is run, and is mapped to the machine into which i am ssh'ing, as an NFS at /vmfs/volumes/VMNFS/. The second cd command doesn't work, neither with symbolic path name nor physical pathname. Why? and How to rectify this?
#!/bin/bash
ssh -2
[email protected] /bin/sh <<\EOF
vmfile_path=`grep / vmvar_file`
datastore_path=/vmfs/volumes/VMNFS/
cd $datastore_path && echo "The present working directory is" `pwd -P`
esxi_vmfile_path_sub=`pwd -P` && echo "variable value is" $esxi_vmfile_path_sub
esxi_vmfile_path=`echo $vmfile_path | sed "s:/VMNFS:$esxi_vmfile_path_sub:"`
cd "$esxi_vmfile_path"
EOF
***Output***:
The current working directory is /vmfs/volumes/65335ec4-46d12e41
variable value is /vmfs/volumes/65335ec4-46d12e41
can't cd to /vmfs/volumes/65335ec4-46d12e41/TPAE7.5/