I am trying to conditionally execute a command using the apache karaf command line, which uses the jline library.
I can't find any documentation on the shell:if command.
For example in linux shell this works:
if [ "foo" = "foo" ]; then echo "good"; fi
When I change the syntax for karaf to:
if [ "foo" = "foo" ] echo "good"
I get the error:
Error executing command shell:if: unable to convert argument condition with value '{foo=foo}' to type org.apache.felix.service.command.Function
I've tried a bunch of different syntax, but I can't figure it out.
Condition syntax works like this:
>if {true} {echo yes} {echo no}
yes
> if {false} {echo yes} {echo no}
no
This command uses closures for each part. This allows you to put an if inside of an each, for example.