Add a pause in the shell script, press any key to continue

Source: Internet
Author: User

When analyzing a complex script, it is sometimes necessary to pause, in a segmented view, to be more clear

So the reference to some of the implementation, the current own use is such a son

#add forDebug by ZqbfunctionGet_char () {Savedstty= ' Stty-g ' Stty-EchoStty CbreakDD if=/dev/tty bs=1Count=1 2>/dev/NULLStty-Raw SttyEchostty $SAVEDSTTY}enable_pause=1functionpause () {if["x$1"!="x"] ; Then      Echo$1    fi    if[$enable _pause-eq1]; Then      Echo "Press any key to continue!"    Char=' Get_char 'fi}

Then call the pause function where it needs to be paused, the parameter is the prompt message

Like what

" xxx OK "  "yyy OK"zzz




This article links http://www.cnblogs.com/zqb-all/p/6296638.html

Add a pause in the shell script, press any key to continue

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.