使用ssh2 exec执行多个命令 [英] Executing more than one command with ssh2 exec

查看:4694
本文介绍了使用ssh2 exec执行多个命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个脚本运行一个命令。基于这个结果,我可以运行下一个命令。步骤:运行第一个脚本,它将我置于全局,然后从全局运行我将运行下一个命令。

第一个命令:

$ stream = ssh2_exec($ connection,'config global') ;

在这个结果后,我应该运行这个原因我需要进入全局

$ stream = ssh2_exec($ connection,'get hardware cpu');

I have a script that runs one command. Based on that result, I can run the next command. Steps:run first script it puts me in global then from global I will run the next command.
First command:
$stream = ssh2_exec($connection, 'config global');
After this result I should run this cause I need to go into global
$stream = ssh2_exec($connection, 'get hardware cpu');

推荐答案

您可以这样做

$stream = ssh2_exec($connection, 'command1;command2');

这篇关于使用ssh2 exec执行多个命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆