Index | Thread | Search

From:
Kirill A. Korinsky <kirill@korins.ky>
Subject:
Re: bin/ksh: add bash-like expand-tilde option
To:
tech@openbsd.org
Date:
Sat, 25 Apr 2026 11:30:03 +0200

Download raw body.

Thread
On Fri, 24 Apr 2026 22:51:17 +0200,
Steffen Nurpmeso <steffen@sdaoden.eu> wrote:
> 
> Kirill A. Korinsky wrote in
>  <87tst06uss.wl-kirill@korins.ky>:
>  |tech@,
>  |
>  |default ksh completion already matches bash with expand-tilde enabled:
>  |typing ~/sr and pressing TAB expands and completes the word to
>  |/home/user/src.
>  |
>  |Here a new option expand-tilde which using the bash name, but keep
>  |current ksh behaviour by enabling it by default.
>  |
>  |Disabling the option preserves the original ~ prefix, so the same input
>  |completes to ~/src.
> 
> (Sorry for the noise -- i have not tried the patch --
> "expand-tilde" is a setting of the readline(3) library, and it
> affects quite a lot of programs on my box.  Indeed, i keep the
> default, "off".
> But still i do not get your explanation from last time.
> If you hit TAB -- with bash -- the only difference is whether
> $HOME (of X) is expanded, or not.  You still get the complete file
> list right away:
> 
>   $ bind 'set expand-tilde on'
>   $ echo ~/.a<TAB>
>   .a   .ax
>   $ echo /home/steffen/.a
> 
>   $ bind 'set expand-tilde off'
>   $ echo ~/.a
>   .a   .ax
>   $ echo ~/.a
> 
> So it seems to me that flow is the actual difference,
> "expand-tilde" has nothing to do with that.
> 

Yes, I'd like to have that behaviour when original ~/.a is preserved in the
shell input and in the history file for C-r.

With my patch it adds it to set +o and set -o level, so it works like this:

~ $ set +o expand-tilde
~ $ echo ~/sr

now I press TAB and last line is

~ $ echo ~/src

~ $ set -o expand-tilde
~ $ echo ~/sr

turns the last line by TAB into

~ $ echo /home/catap/src/                                                                                                                  

Maybe expand-tilde is odd name which confuses, but somehow it is a common
term for that, I think.

-- 
wbr, Kirill