Firstly this can be simplified to simply:
email [EMAIL PROTECTED] -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 [EMAIL PROTECTED] -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 [EMAIL PROTECTED] -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/