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

Re: Bash Zauberei



On 2004-07-09 Stefan Bund <asbund@gmx.de> wrote:
[..]
> Martin Dickopp <martin-deb@zero-based.org> writes:
> >   find ./ -type d | while read i; do
> >
> > Solltest Du allerdings auch Dateinamen haben, die Zeilenumbrüche
> > ("Newlines") enthalten, wird es etwas komplizierter:
> >
> >   find ./ -type d -print0 | xargs -0 bash -c 'while [ $# -gt 0 ]; do
> >     i="$1"
> >     # Hier etwas mit "$i" machen
> >     shift
> >   done' "$0"
[...]

Oder alternativ
find ./ -type d -print0 | while read -rd '' ; do echo "$i" ; done

Das benoetigt aber wirklich bash (fuer read -d), waehrend Martins
Vorschlag wohl auch mit (d)ash oder sogar posh funktionierte.
               cu andreas
-- 
"See, I told you they'd listen to Reason," [SPOILER] Svfurlr fnlf,
fuhggvat qbja gur juveyvat tha.
Neal Stephenson in "Snow Crash"



Reply to: