?

Log in

No account? Create an account

Previous Entry | Next Entry

Pause function in shell script



Apart from using "sleep", here something you can do with BASH to puase something until user responds!

$ cat pause.sh
f_pause()
{
    key=""
    echo -n "Press any key to continue.."
    stty -icanon
    key=`dd count=1 2>/dev/null`
    stty icanon
}

echo "I am here"
f_pause
echo "I am at the end"

Another way :

$ cat pause1.sh
f_pause(){
   read -p "$*"
}

echo "I am here"
f_pause "Hit Enter key to continue."
echo "I am in the last line"

 

Comments

Profile

jaduks
Jadu Kumar Saikia

Latest Month

January 2008
S M T W T F S
  12345
6789101112
13141516171819
20212223242526
2728293031  
Powered by LiveJournal.com
Designed by chasethestars