You're viewing a comment by Sam and its responses.

Sam Permalink
June 18, 2010, 17:30

Thanks for another excellent post!

Which shell are you using? In bash 3.2.48, the builtin read takes a lowercase -n.

I have the following in my .bashrc:

alias timer='(stty -echo; time read -n 1; stty echo) 2>&1 \
              | grep real | sed "s/real/Elapsed time:/"'

Alternatively, one could use:

command time -f "Elapsed time: %es" bash -c "read -n 1"

Not sure why, but stty doesn't seem confined to the sub-shell; ergo calling it the second time.

Reply To This Comment

(why do I need your e-mail?)

(Your twitter name, if you have one. (I'm @pkrumins, btw.))

Type the word "disk_222": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.