www.delorie.com/archives/browse.cgi | search |
X-Spam-Check-By: | sourceware.org |
To: | cygwin AT cygwin DOT com |
From: | Matthew Woehlke <mw_triad AT users DOT sourceforge DOT net> |
Subject: | Re: Bash-Scripting: any way to pre-initialize readline's edit buffer with a user-defined string? |
Date: | Thu, 01 Mar 2007 09:56:02 -0600 |
Lines: | 31 |
Message-ID: | <es6t2i$ru4$1@sea.gmane.org> |
References: | <45E6EAA0 DOT 5090603 AT hima DOT com> |
Mime-Version: | 1.0 |
User-Agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.9) Gecko/20061206 Thunderbird/1.5.0.9 Mnenhy/0.7.4.0 |
In-Reply-To: | <45E6EAA0.5090603@hima.com> |
X-IsSubscribed: | yes |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
Sven Severus wrote: > Hello, > > a simple (i hope ;->) question for bash scripting experts: > > I want to write a script, that interactivly prompts the user > for a couple of input items. So my bash code looks like > this: read -er -p"ItemX: " ITEMX > Most of the items have default values, and I would find it > very user-friendly, if readline's edit buffer would be pre- > initialized with this default value, instead of an empty string. > Then the user just has to hit <return> to enter the default > value, very comfortable. > > Any idea how to achieve this? > Thanks. 1. This has nothing to do with cygwin. You should be asking on the bash mailing list. 2. Try: echo -n "Input [default]: " read input [ -z "$input" ] && input=default ...I do it all the time. -- Matthew Ngx iqct zgg dxei zodt gf ngxk iqfrl. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |