How to logically negate the return value of a command?
Nathan Dorfman
na at rtfm.net
Wed Sep 24 14:27:42 UTC 2014
Are you sure about that? I haven't tried it, but the man page
explicitly states that it will be run from the shell:
The exec keyword executes the specified command under the user's shell.
-- http://man7.org/linux/man-pages/man5/ssh_config.5.html
If it doesn't work, you could always make it exec sh -c 'ping -c1
hostname; test "$?" -ne 0'. I would also suggest notifying the ssh
team that their man page is in error if this is the case.
-nd.
On Tue, Sep 23, 2014 at 2:26 PM, Chris Green <cl at isbd.net> wrote:
> On Tue, Sep 23, 2014 at 11:34:41AM -0400, Nathan Dorfman wrote:
>> On Mon, Sep 22, 2014 at 2:04 PM, Chris Green <cl at isbd.net> wrote:
>> > However this doesn't work of course. Is there any easy way (i.e. an
>> > executable command) which will logically not the value that ping
>> > returns? I know I could write a little script that does the job but
>> > if can do it without I'd be happier.
>>
>>
>> There's probably a nicer way to do it, but this should work:
>>
>> ping -c1 hostname; test "$?" -ne 0
>>
> That won't work in this case because there's no shell running when the
> program is exec'ed from the ssh config file.
>
> --
> Chris Green
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
More information about the ubuntu-users
mailing list