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
|