felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guillaume Nodet <gno...@apache.org>
Subject Re: Gogo shell: eval $cmdline
Date Wed, 07 Sep 2016 09:53:50 GMT
With proper formatting...

Using org.apache.felix.gogo.runtime-0.17.0-SNAPSHOT.jar, I have the
following:


java -cp ../../jline3/target/jline-3.0.0-SNAPSHOT.jar:runtime/target/
org.apache.felix.gogo.runtime-0.17.0-SNAPSHOT.jar:jline/
target/org.apache.felix.gogo.jline-0.1.0-SNAPSHOT.jar
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
org.apache.felix.gogo.jline.Main

g! cmd = 'echo foo'

g! eval $cmd

foo

g! cmdv = [echo foo]

g! eval "$cmdv"

foo


Which seems more intuitive to me, as "$x" should be different from $x, and
the quotes clearly means you want a string.

2016-09-07 11:17 GMT+02:00 Derek Baum <derek@baums.org.uk>:

> eval takes a string argument, not an array:
>
>
> g! cmd = 'lb -s system'
> lb -s system
>
> g! eval $cmd
> START LEVEL 1
>    ID|State      |Level|Symbolic name
>     0|Active     |    0|org.apache.felix.framework (5.4.0)|5.4.0
>
>
> if you really have the command in an array:
>
> g! cmdv = [lb -s system]
> lb
> -s
> system
>
> g! eval "$cmdv"
> lb,
> -s,
> system
>
> you need to convert it to a string first:
>
>
> g! stringclass = ((bundle 0) loadclass java.lang.String)
>
> g! cmds = ($stringclass join " " $cmdv)
> lb -s system
>
> g! eval $cmds
> START LEVEL 1
>    ID|State      |Level|Symbolic name
>     0|Active     |    0|org.apache.felix.framework (5.4.0)|5.4.0
> g!
>
>
> —
> Derek
>
>
> > On 7 Sep 2016, at 09:56, Andreas Sewe <andreas.sewe@codetrails.com>
> wrote:
> >
> > Hi,
> >
> > I am currently struggling with the eval command for the Gogo shell.
> > Unfortunately, I wasn't able to dig up any documentation on it. Not even
> > "help eval" returns something (probably, because eval is not a "real"
> > command).
> >
> > What I want is essentially the following:
> >
> >> cmdline = [ "command" "arg1" "arg2" ]
> >> eval $cmdline
> >
> > Is this possible somehow?
> >
> > Best wishes,
> >
> > Andreas
> >
> > --
> > Codetrails GmbH
> > The knowledge transfer company
> >
> > Robert-Bosch-Str. 7, 64293 Darmstadt
> > Phone: +49-6151-276-7092
> > Mobile: +49-170-811-3791
> > http://www.codetrails.com/
> >
> > Managing Director: Dr. Marcel Bruch
> > Handelsregister: Darmstadt HRB 91940
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > For additional commands, e-mail: users-help@felix.apache.org
> >
>
>


-- 
------------------------
Guillaume Nodet
------------------------
Red Hat, Open Source Integration

Email: gnodet@redhat.com
Web: http://fusesource.com
Blog: http://gnodet.blogspot.com/

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message