linux - How to run a bash function() in a remote host? in Ubuntu -


this question has answer here:

i running bash script, when try run functions on remote machine, says

bash: keyconfig: command not found 

here script:

keyconfig() {     sed -i.bak -r "/^$1/s/([^']+')([^']+)('.*)/\1$2\3/" $3 }  remoteexecution() {     ssh ppuser@10.101.5.91 " keyconfig $1 $2 $4 " }  remoteexecution 

resone error:

when

ssh ppuser@10.101.5.91 " keyconfig $1 $2 $4 " 

you trying execute command keyconfig on remote machine 10.101.5.91 not there:

2 solution problem

1) make script on remotehost contains keyconfig code same name

or

2) execute following instead of function

ssh ppuser@10.101.5.91 "sed -i.bak -r "/^$1/s/([^']+')([^']+)('.*)/\1$2\3/" $3" 

please note may have add few escape depending on sed syntax using


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -