cygwin-email utility clipping attached zips

Matt Wozniski godlygeek@gmail.com
Wed Jan 10 20:00:00 GMT 2007


> Firstly this can be simplified to simply:
>
> email user@example -s test -a $(echo *.pdf|sed "s/ /,/g") <sample.txt
>
> but this will not work if any filename or pathname contains spaces.  You
> can solve that with:
>
> email user@example -s test -a "$(sh -c 'IFS=,; echo "$*"' -- *.pdf)" \
>                 <sample.txt

But that won't work for files with commas in the name!  (Rare, but it
can happen...)  I'd prefer something like

email user@example -s test -a "$(ls -1 *.pdf | tr '\n' ',' )" < sample.txt

Which would only fail if the file name had embedded newlines.  I
suppose `email' probably wouldn't be able to process a file with an
embedded comma in the name one way or the other, but I find this sort
of solution more portable than messing with IFS.

~Matt

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list