第一步:把要執行命令的樣子顯示出來
bash
[root@oldboyedu-39 ~]# chkconfig|egrep "sshd|crond|rsyslog|network|sysstat"|sed -r 's#(^.*)0.*#chkconfig \1 on#g' ssh
chkconfig crond onide
chkconfig network onspa
chkconfig rsyslog onit
chkconfig sshd onclass
chkconfig sysstat onsed
第二步:把要執行命令的樣子顯示出來而且執行network
[root@oldboyedu-39 ~]# chkconfig|egrep "sshd|crond|rsyslog|network|sysstat"|sed -r 's#(^.*)0.*#chkconfig \1 on#g'|bashgrep
第三步:查看執行的結果im
[root@oldboyedu-39 ~]# chkconfig|grep 3:on
crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
rsyslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off
sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
sysstat 0:off1:on2:on3:on4:on5:on6:off