Won't this do what you want? It obviously works on old bash.
echo -n prompt:; writevt -t `tty` -T default; read a;
For example:
testuser@bartlett:~$ echo -n prompt:; writevt -t `tty` -T default;\
read a; declare -p a BASH_VERSION
prompt:default
declare -- a=default
declare --
Apologies, line wrapping messed up my previous reply, corrected here (I
hope).
Won't this do what you want? It obviously works on old bash.
echo -n prompt:; writevt -t `tty` -T default; read a;
For example:
testuser@bartlett:~$ echo -n prompt:; writevt -t `tty` -T default;
read a;
On Sun, Mar 07, 2010 at 21:11:29 -0500, A. Costa (agco...@gis.net) wrote:
Bash isn't strictly needed, plain Bourne shell works, using parameter
substitution
[...]
Thank you for you time and trouble. As it happens, I did in fact
upgrade this lenny box to use bash version 4.1-1 and all is
On Mon, 8 Mar 2010 17:27:22 +, Bob Cox wrote:
(Debian's minimal 'dash' also has a 'read -i', so for
current Debian, the '-i' is universal. Earlier versions,
or other *nixs might not though.)
Not so sure that is correct about dash...
Whoops, you're right, it seems I did a 'man sh' and
Bash isn't strictly needed, plain Bourne shell works, using parameter
substitution
man sh | grep -A 2 -i parameter:-
${parameter:-word}
Use Default Values. If parameter is unset or null, the expansion of
word is substituted. Otherwise, the value of parameter is
What I am trying to do is preload a bash read command with a value
which can be accepted, edited or changed by the user. Some googling
shows that this is dead easy to with the -i option which appeared in
bash version 4 - I have found this:
-
Example: ask for a path with a
On 2010-03-06 04:28, Bob Cox wrote:
What I am trying to do is preload a bash read command with a value
which can be accepted, edited or changed by the user. Some googling
shows that this is dead easy to with the -i option which appeared in
bash version 4 - I have found this:
On Sat, Mar 06, 2010 at 06:21:27 -0600, Ron Johnson (ron.l.john...@cox.net)
wrote:
On 2010-03-06 04:28, Bob Cox wrote:
What I am trying to do is preload a bash read command with a value
which can be accepted, edited or changed by the user. Some googling
shows that this is dead easy to with
On 2010-03-06 06:47, Bob Cox wrote:
On Sat, Mar 06, 2010 at 06:21:27 -0600, Ron Johnson (ron.l.john...@cox.net) wrote:
On 2010-03-06 04:28, Bob Cox wrote:
What I am trying to do is preload a bash read command with a value
which can be accepted, edited or changed by the user. Some googling
* Bob Cox (2010-03-06):
[...]
-
Example: ask for a path with a default value.
Note: The -i option was introduced with Bash 4.
read -e -p Enter the path to the file: -i /usr/local/etc/ FILEPATH
The user will be prompted, he can just accept the default, or edit it.
In 20100306124710.gb25...@bobcox.com, Bob Cox wrote:
On Sat, Mar 06, 2010 at 06:21:27 -0600, Ron Johnson (ron.l.john...@cox.net)
wrote:
On 2010-03-06 04:28, Bob Cox wrote:
-
Example: ask for a path with a default value.
Note: The -i option was introduced with Bash 4.
read
On Sat, Mar 06, 2010 at 09:44:13 -0600, Boyd Stephen Smith Jr.
(b...@iguanasuicide.net) wrote:
PROMPT=stuff
DEFAULT=path
printf '%s [%s] ?' $PROMPT $DEFAULT
read FILEPATH
if [ -z $FILEPATH ]; then
FILEPATH=$DEFAULT
fi
Boyd and André - thank you both for your suggestions, which
12 matches
Mail list logo