Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

The last thing one knows in constructing a work is what to put first. -- Blaise Pascal


devel / comp.unix.shell / "read -e" (Spinoff of other thread about line editing in shell script)

SubjectAuthor
o "read -e" (Spinoff of other thread about line editing in shell script)Kenny McCormack

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

<unujoa$208a4$1@news.xmission.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6831&group=comp.unix.shell#6831

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!newsfeed.endofthelinebbs.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!1.us.feeder.erje.net!feeder.erje.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gaze...@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.unix.shell
Subject: "read -e" (Spinoff of other thread about line editing in shell script)
Date: Sat, 13 Jan 2024 18:11:22 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <unujoa$208a4$1@news.xmission.com>
Injection-Date: Sat, 13 Jan 2024 18:11:22 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="2105668"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Sat, 13 Jan 2024 18:11 UTC

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 flock to claim victory.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor