From: Lao Ming on 17 Dec 2008 21:55 Is there something unusual about pausing a bash script? I admit that I haven't done any interactive input since I started using bash. I want to use 'read' from stdin in order to slow down a loop when doing: bash -x script I tried: while [ condition ] ; do processing ... printf "%s" "Pause: " read mypause done Thanks. but it doesn't work.
From: Barry Margolin on 18 Dec 2008 00:25 In article <b7812cb6-087e-48c0-8dda-e405433be1f9(a)q30g2000prq.googlegroups.com>, Lao Ming <laomingliu(a)gmail.com> wrote: > Is there something unusual about pausing a bash script? > I admit that I haven't done any interactive input since I started > using bash. I want to use 'read' from stdin in order to > slow down a loop when doing: > > bash -x script > > I tried: > > while [ condition ] ; do > processing ... > printf "%s" "Pause: " > read mypause > done > > Thanks. > but it doesn't work. It looks like it should work. Could you be more specific than "doesn't work"? -- Barry Margolin, barmar(a)alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me *** *** PLEASE don't copy me on replies, I'll read them in the group ***
From: Raghu on 18 Dec 2008 03:51 On Dec 18, 7:55 am, Lao Ming <laoming...(a)gmail.com> wrote: > Is there something unusual about pausing a bash script? > I admit that I haven't done any interactive input since I started > using bash. I want to use 'read' from stdin in order to > slow down a loop when doing: > > bash -x script > > I tried: > > while [ condition ] ; do > processing ... > printf "%s" "Pause: " > read mypause > done > > Thanks. > but it doesn't work. The script should work. Will sleep command suffice for you. sleep 5
From: mop2 on 18 Dec 2008 06:34 Lao Ming wrote: > Is there something unusual about pausing a bash script? > I admit that I haven't done any interactive input since I started > using bash. I want to use 'read' from stdin in order to > slow down a loop when doing: > > bash -x script > > I tried: > > while [ condition ] ; do > processing ... > printf "%s" "Pause: " > read mypause > done > > Thanks. > but it doesn't work. Try: # printf "%s" "Pause: " # read mypause read -t1 -p "Pause: " mypause <&2 -t "1" is the time to "autoEnter" if wanted.
From: Chris F.A. Johnson on 18 Dec 2008 11:22
On 2008-12-18, Lao Ming wrote: > Is there something unusual about pausing a bash script? > I admit that I haven't done any interactive input since I started > using bash. I want to use 'read' from stdin in order to > slow down a loop when doing: > > bash -x script > > I tried: > > while [ condition ] ; do > processing ... > printf "%s" "Pause: " > read mypause > done > > Thanks. > but it doesn't work. Is the standard input to the loop or script being redirected from somewhere other than the keyboard? If so, change it to read from .dev.tty: read mypause < /dev/tty -- Chris F.A. Johnson, author <http://cfaj.freeshell.org/shell/> Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress) ===== My code in this post, if any, assumes the POSIX locale ===== and is released under the GNU General Public Licence |