/contrib/dialog/samples/infobox6

https://bitbucket.org/freebsd/freebsd-head/ · Shell · 41 lines · 32 code · 3 blank · 6 comment · 0 complexity · 044a39d9322ef9bbc855140ae900da3e MD5 · raw file

  1. #! /bin/sh
  2. # $Id: infobox6,v 1.7 2011/01/18 09:20:59 tom Exp $
  3. # get rid of all flickering by constructing a script unroll the loop, leaving
  4. # us in curses-mode until we're done counting.
  5. #
  6. # a little fancier than infobox5, this moves the widget at each step.
  7. . ./setup-vars
  8. . ./setup-tempfile
  9. left=10
  10. unit="seconds"
  11. last='\'
  12. cat >>$tempfile <<EOF
  13. $DIALOG $last
  14. EOF
  15. while test $left != 0
  16. do
  17. cat >>$tempfile <<EOF
  18. --sleep 1 \
  19. --begin $left `expr $left + 5` \
  20. --title "INFO BOX" $* $last
  21. --infobox "Hi, this is an information box. It is
  22. different from a message box: it will
  23. not pause waiting for input after displaying
  24. the message. The pause here is only introduced
  25. by the sleep command within dialog.
  26. You have $left $unit to read this..." 0 0 $last
  27. EOF
  28. left=`expr $left - 1`
  29. test $left = 1 && unit="second"
  30. done
  31. echo >>$tempfile
  32. . $tempfile