Discussion: Line editing
Afficher un message
Vieux 28/08/2006, 05h25   #4
Chris F.A. Johnson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Line editing

On 2006-08-28, Salve Håkedal wrote:
> Prompting for input from a script with:
>
> echo "What do you think?"
> read
>
> I start typing, but want to correct, by useing left
> arrow I get:
>
> I hardly thi^[[D
>
> How is that done better?


By using a shell that has an option to allow line editing when
entering text with read.

For example, in bash:

read -ep "Your name: " name

--
Chris F.A. Johnson, author <http://cfaj.freeshell.org>
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence
  Réponse avec citation
 
Page generated in 0,05160 seconds with 9 queries