karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Saikat Ghosh (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 12:04:02 GMT

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

Saikat Ghosh commented on KARAF-5613:
-------------------------------------

Great to know! This is simple fix for existing scripts and we can implement easily.

Are there other changes to be aware of that we can read up on?

Many thanks,

Saycat

> 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