why is this script failing?

Giorgos Keramidas keramida at ceid.upatras.gr
Thu Jul 17 00:19:29 UTC 2008


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 :-)



More information about the freebsd-questions mailing list