我有一个脚本登录到远程服务器。但我试图执行脚本发生一些错误。
日志:
我的剧本:
#!/bin/bash
S1=$(ssh -t selvam-odc-shell1 "users | wc -w ")
S2=$(ssh -t selvam-odc-shell2 "users | wc -w ")
S3=$(ssh -t selvam-odc-shell3 "users | wc -w ")
if [ "$S1" -le 100 ];
then
ssh -t selvam-odc-shell1 " bash"
if [ "$S2" -le 100 ];
then
ssh -t selvam-odc-shell2 "bash"
elif [ "$S3" -le 100 ];
then
ssh -t selvam-odc-shell3 "bash"
else
echo " Shell has been more than 100 users.Please try again later
fi
但是o / p
[user@selvam-odc-sunray2: ~]#./shell.sh
Connection to selvam-odc-shell1 closed.
Connection to selvam-odc-shell2 closed.
Connection to selvam-odc-shell3 closed.
: integer expression expected60
: integer expression expected 29
请帮我解决这个问题。
谢谢 MM SELVAM
您是否尝试使用脚本打开3个shell?
—
LDC3
是的。最后我需要在一个shell中登录
—
Mariselvam