help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: kitty error w bash -bash: declare: -A: invalid option


From: Koichi Murase
Subject: Re: kitty error w bash -bash: declare: -A: invalid option
Date: Thu, 24 Feb 2022 18:09:02 +0900

2022年2月24日(木) 6:00 <write2mark1@gmail.com>:
> no still same issue

Are you sure that you have *exactly* the same issue? Two independent
problems are actually involved here.

----------
> >> > -bash: declare: -A: invalid option
> >> > declare: usage: declare [-afFirtx] [-p] [name[=value] ...]

This error happens when you are using an old version of Bash. If you
have correctly set up a recent version of Bash for the user's default
login shell or for the shell started by kitty, this error for "-A"
should vanish.

FYI, this is caused by the following line [1] of kitty's
shell-integration script, which is released in kitty-0.24.2 just 21
days ago [2]:

> builtin declare -A _ksi_prompt

[1] 
https://github.com/kovidgoyal/kitty/blob/6fa4110da902a776a56ccd44dbdabee83c9d8760/shell-integration/bash/kitty.bash#L8
[2] https://github.com/kovidgoyal/kitty/releases/tag/v0.24.2

----------
> >> > -bash: PROMPT_COMMAND: line 0: syntax error near unexpected token `;'
> >> > -bash: PROMPT_COMMAND: line 0: `find_git_branch; find_git_dirty; ;
> >> > _ksi_prompt_command'

This is an independent problem from the previous one and happens
regardless of the version of Bash you are using. This is a bug in
kitty's shell-integration script [3] and already fixed in the nightly
build of kitty [4]. The fix has not yet released.

[3] https://github.com/kovidgoyal/kitty/issues/4645
[4] 
https://github.com/kovidgoyal/kitty/commit/f9d9fe6db40f1e17f9077f589f730b752bea41fc

----------
By the way, the latest version of kitty's shell-integration script
still seems to have a bug in this line [5]. With this, PROMPT_COMMANDs
specified to other array elements will be lost when PROMPT_COMMAND[0]
is empty. This situation (where the PROMPT_COMMAND[0] is empty and
there are other non-empty elements) is common when one uses the trick
suggested by Martijn Dekker [6]. In fact, my script would be affected
by this version of kitty's shell-integration script...

[5] 
https://github.com/kovidgoyal/kitty/blob/b212fd5bcd2a733768f1fccfa3818301478490c4/shell-integration/bash/kitty.bash#L198
[6] https://lists.gnu.org/archive/html/bug-bash/2020-08/msg00132.html

--
Koichi



reply via email to

[Prev in Thread] Current Thread [Next in Thread]