I need a user pause for a script file, like the pause command in dos. please help I thought it was the corn shell it is csh.
It called the korn shell. How about this...
#! /usr/bin/ksh
function pause
{
typeset savesetting result
print -n "Hit any key to continue..."
savesetting=$(stty -g)
stty -icanon min 1 time 0
result=$(dd bs=1 count=1 2>/dev/null)
stty "$savesetting"
echo
}
echo one
pause
echo two
exit 0
The following is one way of doing it
read prompt?'Press any key to continue .....'
you can 'sleep' for specified amount of time as well,
"man sleep" for details.
can u explain little bit of the pause function u have written.
It displays:
Hit any key to continue...
then it waits until the user types a key. I looked up the pause command and the docs said that this is what it does. And I just noticed that the OP has edited his first post and now says this is csh. Well sorry, but I'm not a csh guy.
Try this
#!/bin/csh
/bin/echo "Press any key to continue .....\c"
set dummy = $<
I am new to this and was wondering if you could also explain what the code means so I can understand and not just use it.