php - phpseclib SSH - Change directory and run script? -


i have script in /home/pi/mydir want execute first thing need

$ssh->exec('cd mydir'); 

and then

$ssh->exec('./script'); 

but it's not working can me?

use \n :

$ssh->exec("cd mydir\n./script"); 

or create file script.sh (example) , save in unix format:

cd mydir ./script 

and exec script:

$script = file_get_contents("script.sh"); $ssh->exec($script); 

Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -