After debugging, the root cause is the shell.init.script couldn't be found with
the default property in the system.properties
{code}
#
# Location of a shell script that will be run when starting a shell
# session. This script can be used to create aliases and define
# additional commands.
# Do not use absolute paths to avoid problems on windows.
#
karaf.shell.init.script = etc/shell.init.script,etc/scripts/*.script
{code}
the absolute path doesn't work on windows so by default it's using relative
path, but FileNotFound will be thrown from
org.apache.karaf.shell.ssh.ShellCommand.executeScript() when try to connect to
karaf using client/client.bat/ssh.
The workarount I found is adding "karaf.exec.init.script" property together
with "karaf.shell.init.script" in the system.properties
{code}
karaf.exec.init.script = ${karaf.etc}/shell.init.script
{code}
Also the default shell.init.script need to be clean up a bit, otherwize, some
shell scripts lines can't be parsed/executed.
I think the logical in the org.apache.karaf.shell.ssh.ShellCommand class should
be synced with the org.apache.karaf.shell.impl.console.ConsoleSessionImpl class.
Regards.
Xilai
________________________________
From: XiLai Dai <[email protected]>
Sent: Monday, February 27, 2017 4:55:31 PM
To: [email protected]
Subject: Re: Fail to execute macro-command e.g. la by client with karaf 4.1.0
JB,
yes, exactly, it's only about aliases commands defined in the
etc/shell.init.script.
________________________________
From: Jean-Baptiste Onofré <[email protected]>
Sent: Monday, February 27, 2017 4:44:56 PM
To: [email protected]
Subject: Re: Fail to execute macro-command e.g. la by client with karaf 4.1.0
Hi Xilai,
I guess that client.bat "bundle:list" works ?
I suspect something about the aliases.
Regards
JB
On 02/27/2017 08:50 AM, XiLai Dai wrote:
> Hi,
>
>
> On karaf 4.1.0, the macro-commands defined in the etc/shell.init.script
> failed to execute from client/client.bat.
>
>
> For example even with the "la" command:
>
> G:\download\apache-karaf-4.1.0\bin>client.bat -h localhost -u karaf "la"
> Logging in as karaf
> Password:
> Command not found: la
> G:\download\apache-karaf-4.1.0\bin>
>
>
> Any changes should be made in the ACL configuration? or is this a bug on
> 4.1.0?
>
>
> Thanks
>
> Xilai
>
--
Jean-Baptiste Onofré
[email protected]
http://blog.nanthrax.net
Talend - http://www.talend.com