[LUGOS] bash skripta za brisanje *.tmp

Matija Grabnar matija.grabnar at arnes.si
Tue Jan 4 20:29:00 CET 2005


On Tue, Jan 04, 2005 at 05:31:28PM +0100, Nejc ?koberne wrote:
> >Zamenjaj rm $i z
> >rm "$i"
> 
> To seveda se vedno ne bo delovalo. Problem je namrec v delovanju 
> bashove for zanke - za delimiter vzame ali "\n" ali " ", torej stvar 
> se vedno ne bo delovala.

Ne delaj se pametnega. Ocitno tega nisi poskusil, ampak 
samo ugibas. Jaz sem ta postopek ze velikokrat uporabil
in VEM, da deluje. Kratka demonstracija:

matija at garden:~/bix$ mkdir /tmp/foo
matija at garden:~/bix$ cd /tmp/foo
matija at garden:/tmp/foo$ touch A\ file\ with\ spaces
matija at garden:/tmp/foo$ touch A\ file\ with\ more\ spaces
matija at garden:/tmp/foo$ for n in * ; do  ls -l $n; done
ls: A: No such file or directory
ls: file: No such file or directory
ls: with: No such file or directory
ls: more: No such file or directory
ls: spaces: No such file or directory
ls: A: No such file or directory
ls: file: No such file or directory
ls: with: No such file or directory
ls: spaces: No such file or directory
matija at garden:/tmp/foo$ for n in * ; do  ls -l "$n"; done
-rw-r--r--  1 matija matija 0 Jan  4 20:24 A file with more spaces
-rw-r--r--  1 matija matija 0 Jan  4 20:24 A file with spaces


Q.E.D. ;-)

> Kako se pa to elegantno resuje?

Glej zgoraj.


More information about the lugos-list mailing list