bash 新手. 請幫我看程式寫的對不對 - Linux

By Brianna
at 2011-11-25T12:11
at 2011-11-25T12:11
Table of Contents
#!/bin/bash
# Passwd file format:
# root:x:0:0:root:/root:/bin/bash
#
# Purpose: Check if remote machines have more than one uid=0 account
#
for host in ma01 ma02
do
COUNT=`ssh $host "cat /etc/passwd | awk '{if ($3 == 0) print $0}' | wc -l "`
if [ $COUNT -gt 1 ]
then
echo "$host : More than one uid 0 account!"
fi
done
不好意思...想請問. 我這樣寫..對不對呢?
謝謝大家了.
--
# Passwd file format:
# root:x:0:0:root:/root:/bin/bash
#
# Purpose: Check if remote machines have more than one uid=0 account
#
for host in ma01 ma02
do
COUNT=`ssh $host "cat /etc/passwd | awk '{if ($3 == 0) print $0}' | wc -l "`
if [ $COUNT -gt 1 ]
then
echo "$host : More than one uid 0 account!"
fi
done
不好意思...想請問. 我這樣寫..對不對呢?
謝謝大家了.
--
Tags:
Linux
All Comments

By Odelette
at 2011-11-27T02:56
at 2011-11-27T02:56

By Charlotte
at 2011-11-28T05:55
at 2011-11-28T05:55
Related Posts
root的聲音不見了, 一般使用者的還在

By Iris
at 2011-11-25T11:50
at 2011-11-25T11:50
資料救援軟體

By Puput
at 2011-11-25T08:58
at 2011-11-25T08:58
Grep如何抓取前一行後兩行

By Bethany
at 2011-11-25T02:24
at 2011-11-25T02:24
Fedora 13 筆電網卡無法驅動

By Lily
at 2011-11-24T20:57
at 2011-11-24T20:57
Linux 主機監控本機端 特定 PORT 流量

By Xanthe
at 2011-11-24T18:47
at 2011-11-24T18:47