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

Bash y espacios en los nombres de fichero



Hola listeros...

Tengo un bug en uno de mis paquetes:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=152825&msg=1&repeatmerged=yes

El sript es este:

#!/bin/sh -f
find . -xdev -type f -printf "%i %p\n" | sort +0 | uniq -0 |
cut -f 2- -d ' ' | tr '\n' '\0' | xargs -0 md5sum | sort +0 -1 |
(
psum='x'
line=''
many=''
while read -r sum file; do
  if [ "$sum" != "$psum" ]; then
    if [ ! -z "$many" ]; then
      set x $line ########### Esta es la linea problematica.
      k="`du $2`" ########### Aqui peta
      shift 2
      echo $k "$@"
    fi
    line="$file"
    psum="$sum"
    many=''
  else
    line="$line $file"
    many=yes
  fi
done 

if [ ! -z "$many" ]; then
  set x $line ############### Esta es la linea problematica again.
  k="`du $2`" ############### Aqui peta
  shift 2
  echo $k "$@"
fi
) | sort +0 -1 -r -n | sed 's/['\''"\]/\\&/g' # Escape properly for xargs.

El tema es que `du $2` pilla solo la primera parte del un nombre de
archivo que tenga espacios... Me gustaria saber como arreglar esto...
¿Quiza haciendo un for al primer find y metiendo el nombre de archivo en
alguna variable?

¿Se os ocurre algo?

-- 
 .''`.       After all, only the mediocre are always at their best.
: :' :                                          -- Jean Giraudoux
`. `'         Proudly running Debian GNU/Linux Sid (2.4.18 + Ext3)     
  `-        www.amayita.com  www.malapecora.com  www.chicasduras.com   
      Listening to Nine Inch Nails - Piggy (bassland dub mix) by Al


-- 
To UNSUBSCRIBE, email to debian-devel-spanish-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: