I want to send a few commands (functions) that are inside a simple .sh file AND stay logged in when ssh-ing to a remote computer.
I’ve tried many ways, but none have worked so far.
Here’s just one:
msh(){
SERVER=$1
LOCAL=10.20.1.1
SSHF=`cat /tmp/sshf.sh`
ssh $SERVER -R 47471:$LOCAL:22 "$SSHF; bash --login"
}
I’ve also tried copying over the file with pipes and streams and whatnot, none have worked.
You need to reserve a terminal at
$SERVER, you do this with the-tswitch. If I change your function to:It seems to do what you want.