why is this script failing?
Gary Kline
kline at thought.org
Thu Jul 17 02:17:26 UTC 2008
On Thu, Jul 17, 2008 at 11:19:49AM +0300, Giorgos Keramidas wrote:
> On Tue, 15 Jul 2008 14:50:24 -0700, Gary Kline <kline at thought.org> wrote:
> > thanks for this clarification! until yesterday, whe you mmentioned
> > blanks[whitespace], as id a song title, i hadn't tought about songs
> > like "Not Ready to Make Nice.ogg" e.g. I am not sure why these
> > players store the song in wav format without deleting the files, but
> > when my limited /tmp is full, certain aps fail mysteriously. with a
> > fwdozen more line of code they could at least fail more gracefully.
>
> For those cases, we have find(1) and xargs(1):
>
> #!/bin/sh
> find /var/tmp -name '*.wav' -exec rm '{}' \+
>
> or
>
> #!/bin/sh
> find /var/tmp -name '*.wav' -print0 | xargs -0 rm
>
> Whitespace handling _is_ important in shell scripts, but it is also a
> good idea to entirely avoid having to handle with it when we can :-)
>
well, by jove--er, Zeus:). i never knew that find had a print0
option. it fputs the entire path, and then glues on the '\0'
byte. thank you very much , Giorgos.
gary
PS: if a bunch of us ever get together and write a fbsd wiki,
this has got to be in there!
--
Gary Kline kline at thought.org www.thought.org Public Service Unix
http://jottings.thought.org http://transfinite.thought.org
More information about the freebsd-questions
mailing list