Mail Archives: cygwin/2007/01/11/20:51:49
heh, I seem to have sparked a short debate on bash scripting
syntax/verbage. Suffice it to say, my original way worked, this way
would most likely work, and I'm sure there are a number of alternative
ways to get the same egg scrambled.
I appreciate everyone's input, I really just wanted to share how I got
it working in case anyone else needed something similar.
regards,
joey
Brian Dessent wrote:
> Matt Wozniski wrote:
>
>>> email user AT 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
>
> This still works fine for filenames with commas since it uses $* which
> joins the positional parameters which have already been split (before
> the subprocess was even invoked), before IFS is changed to ",".
>
> But if a filename has a comma in its name then it is impossible to
> express it as a list of comma-separated filenames without some form of
> quoting. And I doubt that the email program has backslash-escape
> parsing logic for this very rare case (but I haven't checked.)
> Regardless, this:
>
>> email user AT example -s test -a "$(ls -1 *.pdf | tr '\n' ',' )" < sample.txt
>
> ...does not solve the problem either. You get the same output as above,
> except with an erronious trailing ",".
>
> Brian
>
> --
> 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/
>
--
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/
- Raw text -