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-5613) Scripting Behaviour changed from Karaf 4.0.9 to 4.1.5
Date Mon, 19 Feb 2018 10:27:00 GMT

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

Guillaume Nodet commented on KARAF-5613:
----------------------------------------

This small change has been introduced in gogo in order to support new features such as:
{code:java}
karaf@root()> echo {1..2}
["1" "2"]
karaf@root()> echo a{1..2}b                                                           
                                        
["a1b" "a2b"]
{code}
So a closure needs to start with {{"{"}} followed by a space.

> Scripting Behaviour changed from Karaf 4.0.9 to 4.1.5
> -----------------------------------------------------
>
>                 Key: KARAF-5613
>                 URL: https://issues.apache.org/jira/browse/KARAF-5613
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-shell
>    Affects Versions: 4.1.5
>            Reporter: Saikat Ghosh
>            Assignee: Guillaume Nodet
>            Priority: Major
>              Labels: Scripting
>
> Scripting behavior has changed between Karaf v4.0.9 and v4.1.5
> *The following is a shell session for v4.0.10*
> {noformat}
>   Apache Karaf (4.0.10)
> Hit '<tab>' for a list of available commands
> and '[cmd] --help' for help on a specific command.
> Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown Karaf.
> karaf@root()> a1 = "This is a test"
> This is a test
> karaf@root()> a2 = $a1 split " "
> This
> is
> a
> test
> karaf@root()> $a2 2
> a
> karaf@root()> $a2 3
> test
> karaf@root()> each ($a2) {echo $it}
> This
> is
> a
> test
> karaf@root()> each ($a1 split " ") {echo $it}
> This
> is
> a
> test{noformat}
> *The following is a shell session for v4.1.5*
> {noformat}
> karaf@root()> a1 = "This is a test"
> This is a test
> karaf@root()> $a1
> This is a test
> karaf@root()> a2 = ($a1 split " ")
> karaf@root()> $a2 0
> This
> karaf@root()> $a2 1
> is
> karaf@root()> $a2 2
> a
> karaf@root()> each ($a1 split " ") {echo $it}
> usage: each elements { closure }
>        elements: an array to iterate on
>        closure: a function or closure to call
> karaf@root()> $a2
> karaf@root()> each ($a2) {echo $it}
> usage: each elements { closure }
>        elements: an array to iterate on
>        closure: a function or closure to call{noformat}
> In both versions the split creates an array - but the shell does not seem to be automatically
coerce $a2 into an array for v4.1.5
> This is breaking several scripts currently.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message