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

Re: einheitlicher desktop der agelegter benutzer



On Thu, Sep 15, 2005 at 11:14:20AM +0200, Maximilian Wilhelm wrote:
> 
> 	getent passwd | cut -d: -f6 | grep '/home0' |  while read homedir;
> 		do
> 			[ -d "${homedir}" ] && rm -rf "${homedir}/.kde"
> 		done

Cool!

  cut with delimiter colon, the sixth field, pipe into global regular expression print '/home0'

can be rewritten without the "grep" by using the programmable filter AWK

  field seperator is colon, when the sixth field matches '/home0'
                            then print the sixth field

            awk -F: '$6 ~ /\/home0/ { print $6 }'

that avoids invoking the grep executable.

No tjener at hand this moment, but it is verified with

|  $ getent passwd | awk -F: '$6 ~ /\/ro/ { print $6 }'
|  /root


> 
> Ciao
> Max

St


P.S.

See the "Star Wars" spoof "Space Balls" with the famous quote

    I see your schwartz is as big as mine. 

Attachment: signature.asc
Description: Digital signature


Reply to: