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

Re: Help with files and spaces with shell script



> There were some interesting suggestions with setting IFS, but you can
> also do it like this (if there are no newlines in the file names):
>
> find /myth/recordings/ -maxdepth 1 -name \*.mpg -ctime -1 ! -mmin -1
> -print | while read i; do
> /usr/bin/mencoder "$i" -ovc xvid -oac mp3lame -xvidencopts bitrate=800
> -o $TMP/tmp.mpg > $TPM/enc_errors 2>&1 && cp -fv $TMP/tmp.mpg "$i"
> done
>
> No need to change IFS.
>
> --
> Sjoerd Mullender
>
Got to love Linux/BASH.  Always a few ways to so something, and each
one is a good one.  Some who seek the solution that involve the least
CPU time may have a preference.  But for most of us that is not an
issue.  As long as it works as expected, it's a good solution...

By the way I noted a typo in my suggestion.  In the beginning I use
ORIGINAL_IFS for my variable, but for the suggested last line of the
script I had IFS=$ORIGINAL.  That should have been IFS=$ORGINAL_IFS.

Jacques B.


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