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

Re: ¿O.T? Bash Scripting



On Wed, Jan 19, 2005 at 04:30:18PM +0100, matze wrote:
> El Wed, Jan 19, 2005 at 04:24:19PM +0100 Txente ha dit:
> 
> > No se si es Off topic, si es asi ignorad el mensaje y mis disculpas por 
> > adelantado.
> > 
> > 
> > Prentedo comprimir con Gzip todos los archivos que cuelgan de un 
> > determinado direrctorio (/var/proyectos) y para ello he ido averiguando 
> > un script...
> > ===========================================================
> > for each in $(find /var/proyectos/* | grep -v .gz);
> > do
> >   if [ -f $each ]
> >   then
> >      echo $each
> >      gzip -9f $each

¿Y unas comillas? Así: "$each". La respuesta que te dan es mejor, más
elegante y eficiente, pero podrías probar lo de las comillas para salir
de la duda.

> >   fi
> > done;
> > ===========================================================
> > 
> > 
> > Tienen que estar los ficheros uno a uno, no puedo hacer un tar de los 
> > directorios, ni inventos. El problema viene con los ficheros con nombre 
> > largo y que tienen espacio dentro del mismo ("Mi Documento.doc", por 
> > ejemplo). No se exactamente que pasa, pero lo que es obvio es que no me 
> > los comprime :-(
> > 
> > Cualquier idea/sugerencia sera bien recibida. Ah! no, no puedo renombrar 
> > los nombres... :-)
> 
> find -type f ! -name *.gz -print -exec gzip -9f {} \;
> 
> debería hacer lo que intentas hacer con el scriptillo
> 
> m.
> 
> -- 
>               Insanity: doing the same thing over and over
>                 again and expecting different results
>                             (Albert Einstein)
> 
>            ( ( ( i ) ) )  http://indymedia.org  ( ( ( i ) ) )
>                                                                  .''`.
>     using free software / Debian GNU/Linux | http://debian.org  : :'  :
>                                                                 `. `'`
> gpg --keyserver keys.indymedia.org --recv-keys B9A88F6F           `-



-- 
pepe AT apteta DOT net / jmchalmes AT polinux DOT upv DOT es
http://www.polinux.upv.es / http://www.valux.org / http://www.hispalinux.es
GnuPG key = 0x6FDE933B [D5C4 12CE D6B4 E4D6 7E8E  F128 405A BFAD 6FDE 933B]

Attachment: signature.asc
Description: Digital signature


Reply to: