[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: one last...





> My goal here is to get lines from /etc/passwd that do not have a UID that
> is already in the $NEW file.

Can you chill out for a while, now? I'm trying to get some work done.  :)


#!/bin/bash

OLD="/etc/passwd"
NEW="~/passwd.new"

while read LINE1; do
   ID1=$(echo $LINE1 | cut -d':' -f3)
   FLAG=0
   while read LINE2; do
      ID2=$(echo $LINE2 | cut -d':' -f3)
      if [ $ID1 = $ID2 ]; then
         FLAG=1
      fi
   done < $NEW
   if [ $FLAG -eq 0 ]; then
      echo $LINE1 >> $NEW
   fi
done < $OLD


--
To unsubscribe, send email to majordomo@luci.org with
"unsubscribe luci-discuss" in the body.