[PLUG] bash command to wait for key press

Chris Jantzen chris-plug at maybe.net
Sat Nov 22 23:06:01 UTC 2003


On Sat, Nov 22, 2003 at 04:55:53PM -0800, Marvin J. Kosmal wrote:
> On Sat, 2003-11-22 at 16:17, David Fleck wrote:
> > On Sat, 22 Nov 2003, Marvin J. Kosmal wrote:
> > > How about
> > >
> > > echo -n "Please insert a CD"
> > > read cd
> > > echo "Thanks for the CD"
> > >
> > > read will wait for the input and return key..
> > >
> > > HTH
> > >
> > 
> > Or:
> > 
> >   read -p "Please insert a CD: " cd
> 
> I like better then my solution..

Although, for the record, -p is a bashism and is non-portable to other
POSIX-like shells. No reason not to use it in particular, it is certainly
more elegant, but be aware in case it breaks on a non-GNU system and
you can't figure out why. Be safe: use #!/bin/bash instead of #!/bin/sh

-- 
chris kb7rnl =->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.pdxlinux.org/pipermail/plug/attachments/20031122/221b4ea1/attachment.asc>


More information about the PLUG mailing list