Re: Shell Script Exercise

Página superior
Adjuntos:
Obtener este mensaje como un correo
+ (text/plain)
Eliminar este mensaje
Responder a este mensaje
Autor: Eric \"Shubes\"
Fecha:  
A: plug-discuss
Asunto: Re: Shell Script Exercise
Gerald Thurman wrote:
> I wrote a command that moves all the files having
> the permissions "rw-------" (i.e. 600) found in a
> directory to a different directory. The command
> has the following logic inside of a loop.
>
> ls -l $filename | grep -q "^-rw-------" # line 1
> [ $? -eq 0 ] && mv $filename $newdir
>
> The command works, but I wanted to replace line #1 with a
> single command eliminating the pipe. Initially, I thought the
> 'test' command would be sufficient, but it's not. Any ideas?
>

Something like:
find . -maxdepth 0 -name $filename -perm 600 -exec mv {} $newdir \;

-- 
-Eric 'shubes'
"There is no such thing as the People;
  it is a collectivist myth.
  There are only individual citizens
  with individual wills
  and individual purposes."
-William E. Simon (1927-2000),
     Secretary of the Treasury (1974-1977)
  "A Time For Truth" (1978), pg. 237



---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss