Something like the following?Is there a common, standard way to wait for the press of any single key
in a batch job?
Tricky. Old-style (serial) terminals were outright unable to send anything less than a line of input to the computer. What do you call a "batch" job? Usually that means a background job which gets run when there's time, and by definition implies it's not interactive, ergo, no wait for keypress possible. If you mean to say shell script, investigate the stty program and temporarily put the terminal into raw mode and so on, perhaps it'll work. Of course, waiting for pressing <enter> is trivial - that's called "read" in bash. You could also fire up something like
kdialog --msgbox "Press any key to continue"
or write your own short program in C.
/bin/*sh* -c "read -p \"Press CTRL+C to abort and ENTER to continue !\" _e"
or perhaps
echo "*Press any key* to continue..."
perl -e 'system("stty", "cbreak"); getc(STDIN); system("stty", "-cbreak"); 'or even
#!/bin/sh
echon() {
if [ -n "`echo -n`" ] ; then
echo "[EMAIL PROTECTED]"
else
echo -n "$@"
fi
}echon "Press any key to continue: " TTYSTATE=`stty -g` stty raw dd if=/dev/tty of=/dev/null bs=1 count=1 > /dev/null 2>&1 stty "$TTYSTATE" echo
or you could just
echo -n "Press any key to continue... " stty cbreak dd of=/dev/null bs=1 count=1 2>/dev/null stty -cbreak echo
-- Paul Wilkins
