linux - Can I call a local function from ssh? -
i know can call variables local shell in ssh session, assumed call function way too. doesn't seem work.
i have script checks if local machine can handle operations , if can need call local functions, if local machine cannot need ssh remote machine , call local functions.
canhandle() { if [ -d /this_must_exist/ ] return 0 else return 1 fi } localfunction() { // predefined tasks } canhandle if [ $? -eq 0 ] // process locally using predefined functions localfunction else ssh -t me@server << endssh // process remotely calling predefined local functions localfunction endssh fi
imho not work.
local variables expanded on local shell, , transferred expanded.
you write bash script doing same local function, , write function copy via scp remote system, execute there via shh , delete afterwards.
Comments
Post a Comment