[Top][All Lists]

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

Re: Do a readline function execution inside bash

From: Greg Wooledge
Subject: Re: Do a readline function execution inside bash
Date: Mon, 14 Sep 2020 11:32:44 -0400
User-agent: Mutt/1.10.1 (2018-07-13)

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

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.

reply via email to

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