nmh-workers
[Top] [All Lists]

[Nmh-workers] Quoting for test commands

2013-11-13 21:17:09
This technically isn't a question about nmh, but it's for work I'm doing
on adding a new test to the nmh test suite, so I figure it's vaguely
relevant.

I'm having a heck of a time figuring out how to do shell quoting right
with command substitution.  Specifically, I want to do this:

run_test 'fmttest -raw -format %(unquote) "Mr. Foo Bar" ...

the first argument of run_test gets executed like this:

        actual_output=`$1 2>&1`

So, I want the last arguent to "fmttest" to be a SINGLE argument, but I can't
quite figure out how to make it happen.  It always ends up as 3 arguments;
specifically, this command returns:

"Mr.
Foo
Bar"

(Each "word" interpreted as an individual argument).  I've played around with
single quotes, double quotes, backslashes, and clearly I'm missing something.
I guess it's weird interaction between parameter substitution and command
substitution that I'm not smart enough to figure out.  Help?

--Ken

_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>