user input from shell scripts

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: der.hans
Date:  
Subject: user input from shell scripts
Am 01. Oct, 2003 schw=E4tzte Mike Starke so:

> I am trying to convert a couple perl scripts to simple
> shell scripts (nothing but a simple excercise for myself).


Good. Once it's in perl, it's a shame to take the technical step back to
shell. Mind you, I love shell ( I even wrote PHP using a shell script long
before I wrote PHP using Perl ), but for most non-trivial things Perl is
better.

I got reminded of this Fri when I spawned over 3 million sub-shells for a
quick and dirty script. Next time I'll use Perl for that task :).

> The basic format I have always used went something like this:
>
> print "Enter Your Name: ";
> $name =3D <STDIN>;
> chomp $name;
>
> Would the following be the proper way for bash?
>
> echo "EnterYour Name: "
> read -e NAME
> echo $NAME


echo "<$NAME>"

That'll show you that it is indeed what you want.

You might want to add -n to the first echo.

ciao,

der.hans
--=20
#  https://www.LuftHans.com/    http://www.AZOTO.org/
#  We now return you to your regularly scheduled paranoia...