hstr
hstr copied to clipboard
Running as root doesn't make you double-enter the choice without TIOCSTI
I have the following in .bashrc:
if [[ $- == *i* ]]; then
_hstrnotiocsti() {
{ READLINE_LINE="$( { </dev/tty hstr "${@:-}" $READLINE_LINE; } 2>&1 1>&3 3>&- )"; } 3>&1
READLINE_POINT=${#READLINE_LINE}
}
export HSTR_TIOCSTI=n
export HSTR_CONFIG='blacklist,hicolor,help-on-opposite-side,raw-history-view,static-favorites'
export HSTR_PROMPT='> '
bind -x '"\C-r": _hstrnotiocsti --'
bind -x '"\C-s": _hstrnotiocsti -f'
fi
For every user other than root, I have to confirm selection by pressing Enter the second time to actually invoke a command from history that appears in the command line. With root however, the command gets executed instantly. How to replicate the non-root user behavior on root?