Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save spidersea/8110409 to your computer and use it in GitHub Desktop.
Save spidersea/8110409 to your computer and use it in GitHub Desktop.
Linux shell脚本 while命令解决 ssh登陆单行问题
#!/bin/bash
cat list |while read line
do
echo ===============$line
TARGE_IP=`echo $line|awk '{print $3}'`
TARGE_PORT=`echo $line|awk '{print $4}'`
ssh -p $TARGE_PORT $TARGE_IP "ps axu|grep webserver" < /dev/null
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment