nmh-workers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nmh-workers] Quoting for test commands


From: Ken Hornstein
Subject: [Nmh-workers] Quoting for test commands
Date: Wed, 13 Nov 2013 22:16:33 -0500

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]