karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Guillaume Nodet (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (KARAF-3264) What is the AND operator in shell:if ?
Date Sun, 12 Oct 2014 23:35:34 GMT

    [ https://issues.apache.org/jira/browse/KARAF-3264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14168843#comment-14168843
] 

Guillaume Nodet commented on KARAF-3264:
----------------------------------------

No operators are defined in felix nor karaf.
They are completely missing, and it would be nice to have support for: &&, ||, !,
+, -, *, /, %, <, >, <=, >=, ==, !=

> What is the AND operator in shell:if ?
> --------------------------------------
>
>                 Key: KARAF-3264
>                 URL: https://issues.apache.org/jira/browse/KARAF-3264
>             Project: Karaf
>          Issue Type: Question
>          Components: karaf-documentation, karaf-shell
>    Affects Versions: 2.3.7
>            Reporter: Niels Bertram
>            Priority: Minor
>
> I have tried to create an shell:if condition that tests for multiple AND / OR operators
but I am unable to find any useful documentation in KARAF or FELIX nor did anyone respond
to user forum emails or was there any hint in unit tests as to how to construct a if condition
with multiple operants.
> Using the debugger, I can see in {{org.apache.felix.gogo.runtime.Closure}} that there
is something amiss when executing my code but I tried quite a few permutations without any
luck.
> Example of what I thought the most likely syntax it should be but fail, fail, fail ...
any chance someone with some scripting credentials is able to comment? I am offering to write
it up with a few examples for the developer documentation!
> {code}
> foo = "foo"
> bar = "bar"
> if { &($foo equals "foo")($bar equals "bar") } { echo "yes foo and bar" } { echo
"no foo and bar" }
> {code}
> another one I tried:
> {code}
> foo = "foo"
> bar = "bar"
> if { $foo equals "foo" && $bar equals "bar" } { echo "yes foo and bar" } { echo
"no foo and bar" }
> {code}
> or this one:
> {code}
> foo = "foo"
> bar = "bar"
> if { [ $foo equals "foo" , $bar equals "bar" ] } { echo "yes foo and bar" } { echo "no
foo and bar" }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message