|
Rockbox mail archiveSubject: Re: MP3 Managing Tool?Re: MP3 Managing Tool?
From: Neon John <johngd_at_bellsouth.net>
Date: Fri, 14 Jan 2005 18:32:18 -0500 On Fri, 14 Jan 2005 15:15:58 -0800, Menachem Shapiro <menachem.shapiro_at_gmail.com> wrote: >----script excerpt-------- > for f in `ls "$MOUNT"|sed 's/ /_-_-_/g'`; do > f=`echo "$f"|sed 's/_-_-_/ /g'` > echo "cp $f -> $TARGET" > cp "$f" "$TARGET" 2>/dev/null >&1 || faildo "$f" > unset f > done >--------end excerpt-------- > >Is it standard practice to use the same variable ('f') as the variable >used for the for loop? I noticed it gets unset at the end, but it >seems a little scary. Perfectly normal. the loop runs until the list produced by the ls |sed pipe is exhausted, then exits. When the list is exhausted, f is not assigned anything. The unset leaves f with a null string which is FALSE in the "for" conditional. I can't think of any easier way to do that in a shell script. Clever. John --- John De Armond johngdDONTYOUDARE_at_bellsouth.net http://bellsouthpwp.net/j/o/johngd/ Cleveland, Occupied TN _______________________________________________ http://cool.haxx.se/mailman/listinfo/rockboxReceived on 2005-01-15 Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy |