simply run a readline function among lines codes of bash script such a menu-complete, or menu-complete repeated thrice, or etc etc
On 9/14/20, Greg Wooledge <wool...@eeg.ccf.org> wrote: > On Mon, Sep 14, 2020 at 10:09:16PM +0700, Budi wrote: >> How to do a readline function execution inside bash script as mimic to >> actual key press ? > > Please tell us what you're actually trying to do. It makes a huge > difference. > > You said "script", so I guess you don't want to pre-populate the input > buffer of an interactive shell. That would be one goal, and we could > tell you how to do that, but if it's not what you want, that would be > a waste of time. > > Perhaps you want to pre-populate the user's response to a prompt written > by the script, for a read command. That's pretty easy: you just have to > tell read to use readline (-e), and then supply an initial response (-i). > > read -r -e -i "$LOGNAME" -p "Who are you? " who > > If that's not what you want, then we need to know what you *do* want. >