* How to pass parameters containig options from variables
@ 2012-09-25 8:47 bd
2012-09-25 13:21 ` Olof Johansson
0 siblings, 1 reply; 5+ messages in thread
From: bd @ 2012-09-25 8:47 UTC (permalink / raw)
To: dash
Hello list,
I am trying to pass these arguments
-N -p -F "not host foo"
to a binary, but
ARGS="-N -p -F 'not host foo'"
$DAEMON $ARGS
get's passed as 6 arguments and not 4.
Using xargs this works, but I'd like to not introduce that dependency:
ARGS="-N -p -F 'not host foo'"
echo $ARGS | xargs $DAEMON
Now for the complete picture, it's the init script for arpwatch. Options that
should be passed to arpwatch can be specified by the sysadm in
/etc/default/arpwatch with is sourced by the initscript and then passed (via
start-stop-daemon) to the arpwatch binary.
This is on debian stable, package version 0.5.5.1-7.4
Stefan
--
Reader, suppose you were an idiot. And suppose you were a member of
Congress. But I repeat myself.
-- Mark Twain
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to pass parameters containig options from variables
2012-09-25 8:47 How to pass parameters containig options from variables bd
@ 2012-09-25 13:21 ` Olof Johansson
2012-09-25 16:28 ` bd
0 siblings, 1 reply; 5+ messages in thread
From: Olof Johansson @ 2012-09-25 13:21 UTC (permalink / raw)
To: bd; +Cc: dash
Hi,
On 2012-09-25 10:47 +0200, bd@bc-bd.org wrote:
> I am trying to pass these arguments
>
> -N -p -F "not host foo"
>
> to a binary, but
>
> ARGS="-N -p -F 'not host foo'"
> $DAEMON $ARGS
>
> get's passed as 6 arguments and not 4.
eval $DAEMON $ARGS should work.
--
---------------------------------------------------------------
| Olof Johansson http://stdlib.se/ |
| irc: zibri https://github.com/olof |
---------------------------------------------------------------
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to pass parameters containig options from variables
2012-09-25 13:21 ` Olof Johansson
@ 2012-09-25 16:28 ` bd
2012-09-25 16:48 ` Paul Gilmartin
0 siblings, 1 reply; 5+ messages in thread
From: bd @ 2012-09-25 16:28 UTC (permalink / raw)
To: dash
Hi,
> eval $DAEMON $ARGS should work.
That did it, thank you.
Regards,
Stefan
--
BOFH excuse #230:
Lusers learning curve appears to be fractal
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to pass parameters containig options from variables
2012-09-25 16:28 ` bd
@ 2012-09-25 16:48 ` Paul Gilmartin
2012-09-25 18:55 ` Harald van Dijk
0 siblings, 1 reply; 5+ messages in thread
From: Paul Gilmartin @ 2012-09-25 16:48 UTC (permalink / raw)
To: dash
On Sep 25, 2012, at 10:28, bd@bc-bd.org wrote:
>
>> eval $DAEMON $ARGS should work.
>
> That did it, thank you.
>
... but always beware of "eval" if you don't absolutely
control the argument string. A single semicolon and
someone owns your process.
-- gil
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to pass parameters containig options from variables
2012-09-25 16:48 ` Paul Gilmartin
@ 2012-09-25 18:55 ` Harald van Dijk
0 siblings, 0 replies; 5+ messages in thread
From: Harald van Dijk @ 2012-09-25 18:55 UTC (permalink / raw)
To: dash
On 25-9-2012 18:48, Paul Gilmartin wrote:
> On Sep 25, 2012, at 10:28, bd@bc-bd.org wrote:
>>> eval $DAEMON $ARGS should work.
>> That did it, thank you.
> ... but always beware of "eval" if you don't absolutely
> control the argument string. A single semicolon and
> someone owns your process.
For a configuration file that gets sourced, the person creating the
configuration file already owns the process, so there is no added
security by avoiding eval here.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-09-25 19:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-25 8:47 How to pass parameters containig options from variables bd
2012-09-25 13:21 ` Olof Johansson
2012-09-25 16:28 ` bd
2012-09-25 16:48 ` Paul Gilmartin
2012-09-25 18:55 ` Harald van Dijk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).