grep命令的静默标志被忽略

时间:2020-01-16 11:53:17

标签: bash

$ sudo service --status-all | grep -q oijawpawuouzmaomwaoiwadlknasdlknascsc &>/dev/null
 [ ? ]  hwclock.sh
 [ ? ]  kmod
 [ ? ]  plymouth
 [ ? ]  plymouth-log
$ sudo service --status-all
 [ + ]  apache-htcacheclean
 [ + ]  apache2
 [ - ]  apparmor
 [ + ]  awslogs
 [ - ]  console-setup.sh
 [ - ]  cron
 [ - ]  dbus
 [ ? ]  hwclock.sh
 [ + ]  irqbalance
 [ - ]  keyboard-setup.sh
 [ ? ]  kmod
 [ + ]  php7.2-fpm
 [ ? ]  plymouth
 [ ? ]  plymouth-log
 [ - ]  procps
 [ - ]  rsync
 [ - ]  rsyslog
 [ + ]  udev
 [ - ]  ufw
 [ - ]  unattended-upgrades
 [ - ]  uuidd
 [ - ]  x11-common

想知道为什么出现带有安静标志的grep输出,将输出发送到dev null还是失败。

对于混乱的东西为何与任何东西匹配我也感到困惑。

0 个答案:

没有答案