X-Spam-Check-By: sourceware.org
Message-ID: <17393e3e0701101200m630f651ch5fe9b623fe7d33b@mail.gmail.com>
Date: Wed, 10 Jan 2007 15:00:00 -0500
From: "Matt Wozniski" <godlygeek@gmail.com>
To: cygwin@cygwin.com
Subject: Re: cygwin-email utility clipping attached zips
In-Reply-To: <45A52E6C.61D53739@dessent.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
References: <006701c734d6$d8531e00$a501a8c0@CAM.ARTIMI.COM> 	 <45A520B8.7090802@wi.rr.com> <45A52736.2040009@gmx.de> 	 <45A5292A.20606@gmx.de> <45A52E6C.61D53739@dessent.net>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

> 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/

