user input from shell scripts

Página superior
Adjuntos:
Obtener este mensaje como un correo
+ (text/plain)
Eliminar este mensaje
Responder a este mensaje
Autor: Patrick Fleming
Fecha:  
Asunto: user input from shell scripts

Mike Starke wrote:

> I am trying to convert a couple perl scripts to simple
> shell scripts (nothing but a simple excercise for myself).
>
> The basic format I have always used went something like this:
>
> print "Enter Your Name: ";
> $name = <STDIN>;
> chomp $name;
>
> Would the following be the proper way for bash?
>
> echo "EnterYour Name: "
> read -e NAME
> echo $NAME


The method I use for several scripts (and it seems to work ok)
echo "Enter your Name: "
read PS1
echo $PS1