Having single or double quotes in a custom variable

Diego Roccia diego.roccia at gmail.com
Mon Sep 6 15:50:48 CEST 2010


Single quotes are quite good, but, as Marc said, He needs to preserve them, too.
The only simple idea I can give is escaping them. I don't know why
it's not working, I'd advice to turn on command logging

bye
Diego

On Mon, Sep 6, 2010 at 3:32 PM, Marc Powell <lists at xodus.org> wrote:
>
> On Sep 6, 2010, at 6:57 AM, Jelle Smet wrote:
>
>> _blah           "one two three four" a b c d
>>
>> I want to use this custom variable in a command to execute like this:
>>
>> define command{
>>
>> command_name    check_linux_nrpe_all_disks
>>
>> command_line    /bin/echo $_HOSTBLAH$ > /tmp/fubar.txt
>>
>> }
>>
>>
>> In /tmp/fubar.txt I have this line of text without the quotes:
>> one two three fou a b c d
>
> That's what 'echo "one two three four" a b c d > /tmp/fubar.txt' does on the command line --
>
> $ echo "one two three four" a b c d > /tmp/fubar.txt
> $ cat /tmp/fubar.txt
> one two three four a b c d
>
>> How can I keep the quotes?  They can be single or double quotes it doesn't matter.
>
> command_line    /bin/echo '$_HOSTBLAH$' > /tmp/fubar.txt
>
> $ echo '"one two three four" a b c d' > /tmp/fubar.txt
> $ cat /tmp/fubar.txt
> "one two three four" a b c d
>
> --
> Marc
>
>
> ------------------------------------------------------------------------------
> This SF.net Dev2Dev email is sponsored by:
>
> Show off your parallel programming skills.
> Enter the Intel(R) Threading Challenge 2010.
> http://p.sf.net/sfu/intel-thread-sfd
> _______________________________________________
> Nagios-users mailing list
> Nagios-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users
> ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
> ::: Messages without supporting info will risk being sent to /dev/null
>



-- 
Diego Roccia
diego.roccia (at) gmail (dot) com

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null


More information about the Users mailing list