• "read -e" (Spinoff of other thread about line editing in shell script)

    From Kenny McCormack@21:1/5 to All on Sat Jan 13 18:11:22 2024
    Re: Discussion in other thread about whether or not "read -e" works (for suitable values of "works").

    I have to admit that I just tested it on the command line and it worked as expected (up/down arrows scrolled back and forth over my previously entered shell command lines). So, I expected/assumed it would work in a script.
    But, alas, it doesn't.

    Here's my test script:

    --- Cut Here ---
    #!/bin/bash
    ### INPUTRC=/tmp/inputrc
    ### HISTFILE=/tmp/histfile
    set -o vi
    while read -ep "Enter something: "
    do echo "You said: $REPLY"
    done
    --- Cut Here ---

    The INPUTRC file contains "set history-size 100".

    The funny thing is that the arrow keys are recognized, and the left/right
    works as expected, but up/down doesn't retrieve previous lines.

    Anyway, it will be interesting to see if anyone else can get this to work. Note: I am *not* looking for "tech support" on the above script. I am trying to see if anyone else can get it to work for themselves, or if Christian is indeed right that it simply doesn't work.

    BTW, what I mean by "the keys are recognized" is that they don't echo on
    the screen as something like [A or whatever, as they would if we omit the
    "-e" from the "read" statement.

    --
    Debating creationists on the topic of evolution is rather like trying to
    play chess with a pigeon --- it knocks the pieces over, craps on the
    board, and flies back to its f