0
任何一个可以帮助我如何用grep在输出中while循环中的Bash shellgrep的内部while循环在bash
[email protected]:~# while true; do 'netstat -tuplen | grep sshd'; sleep 2; done
-sh: netstat -tuplen | grep sshd: command not found
任何一个可以帮助我如何用grep在输出中while循环中的Bash shellgrep的内部while循环在bash
[email protected]:~# while true; do 'netstat -tuplen | grep sshd'; sleep 2; done
-sh: netstat -tuplen | grep sshd: command not found
正如@Cyrus说,所有你需要做的是去除单引号:
while true; do netstat -tuplen | grep sshd; sleep 2; done
或
while true; do
netstat -tuplen | grep sshd
sleep 2
done
卸下两个单引号。 – Cyrus
'while sleep 2;做netstat -tuplen | grep'[s] shd'; done' – ghoti