I have a use case similar to the below code. Need to export parameterized variables/identifier to remote shell script from a shell script. I used the below code but I cannot export the value. Please suggest how to do it.
A.sh (script 1)
#!/bin/bash
sshpass -p asdf ssh [email protected]<<'ENDSSH'
export directory="$1"
sh /../B.sh
ENDSSH
B.sh (script 2)
#!/bin/bash
echo directory=$directory
mkdir $directory
#Execution
sh A.sh '/data/2017-7-7/'
#output
directory=
I get the value in the remote shell script when I hard code the value.
export directory='/data/2017-7-7/'
I want to export parameterized variable, please suggest how to implement this.Thanks