Access and append local file from remote host in bash script
问题 From my bash script, doing ssh login to the remote host. Sending my config file along with a script to the remote host to access the variables. Code is as below: #!/bin/bash source ~/shell/config.sh script=$(cat <<\____HERE pubkeyarray=() privkeyarray=() for (( w=1; w<=3; w++)) do cleos create key --file key[$w].txt privatekey=$(sed -ne 's/^Private key: \([^ ]*\).*/\1/p' ~/key[$w].txt) pubkey=$(sed -ne 's/^Public key: \([^ ]*\).*/\1/p' ~/key[$w].txt) pubkeyarray+=("$pubkey") privkeyarray+=("