[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: read -e bug
From: |
Chris F.A. Johnson |
Subject: |
Re: read -e bug |
Date: |
Thu, 28 May 2009 09:29:32 -0400 (EDT) |
User-agent: |
Alpine 2.00 (LMD 1167 2008-08-23) |
On Thu, 28 May 2009, Pierre Gaston wrote:
> On Thu, May 28, 2009 at 3:52 PM, Chris F.A. Johnson <cfaj@freeshell.org>
> wrote:
> > On Thu, 28 May 2009, Chet Ramey wrote:
> >
> >> >
> >> > This is nothing new; it happens in all versions of bash:
> >> >
> >> > printf "Enter something: "
> >> > read -e whatever
> >> >
> >> > Press a key, then cursor left (or ^A); the cursor moves to the
> >> > beginning of the line, over "E" instead of over the character just
> >> > entered.
> >>
> >> This isn't a bug; that's where readline thinks the cursor is.
> >
> > Why would it think that? It's wrong.
> >
> >> If you want to use a prompt, use `read -p'.
> >
> > I like to write portable scripts; read -p is not portable.
>
> well, read -e is not more portable than read -p afaict
Good point!
--
Chris F.A. Johnson, webmaster <http://woodbine-gerrard.com>
===================================================================
Author:
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)