Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
向变量传递服务应答的bash脚本_Bash_Ssh_Terminal - Fatal编程技术网

向变量传递服务应答的bash脚本

向变量传递服务应答的bash脚本,bash,ssh,terminal,Bash,Ssh,Terminal,我正在编写一个bash脚本来自动登录ssh。一个人通过执行ssh命令然后传递密码来连接。我已经通过使用sshpass实现了自动化。登录后,服务器会回复一条消息“you are loggin”。此消息显示在终端中,我不想显示在终端中,而是存储在bash变量中。 谢谢你的帮助 检查/etc/motd的内容和/etc/ssh/sshd\u config中的横幅字段。我假设其中一个就是“you is loggin”(您已登录)消息的来源。只需清空消息并重新启动sshd。这将抑制消息。您的意思是这样吗 V

我正在编写一个bash脚本来自动登录ssh。一个人通过执行ssh命令然后传递密码来连接。我已经通过使用
sshpass
实现了自动化。登录后,服务器会回复一条消息“you are loggin”。此消息显示在终端中,我不想显示在终端中,而是存储在bash变量中。
谢谢你的帮助

检查
/etc/motd
的内容和
/etc/ssh/sshd\u config
中的
横幅
字段。我假设其中一个就是“you is loggin”(您已登录)消息的来源。只需清空消息并重新启动sshd。这将抑制消息。

您的意思是这样吗

VARIABLE=$(ssh otherhost command)
这只需在其他主机上执行
命令
,并在完成后终止SSH会话