/contrib/dialog/samples/textbox2

https://bitbucket.org/freebsd/freebsd-head/ · Shell · 44 lines · 38 code · 4 blank · 2 comment · 1 complexity · 4f6536bae6ec35bfb41e26848a33e72d MD5 · raw file

  1. #!/bin/sh
  2. # $Id: textbox2,v 1.8 2010/01/13 10:36:49 tom Exp $
  3. . ./setup-vars
  4. . ./setup-tempfile
  5. cat << EOF > $tempfile
  6. Hi, this is a text dialog box. It can be used to display text from a file.
  7. The file should not contain any 'tab' characters, so you should 'expand'
  8. the file first if it contains 'tab' characters.
  9. It's like a simple text file viewer, with these keys implemented:
  10. PGDN/SPACE - Move down one page
  11. PGUP/'b' - Move up one page
  12. ENTER/DOWN/'j' - Move down one line
  13. UP/'k' - Move up one line
  14. LEFT/'h' - Scroll left
  15. RIGHT/'l' - Scroll right
  16. '0' - Move to beginning of line
  17. HOME/'g' - Move to beginning of file
  18. END/'G' - Move to end of file
  19. '/' - Forward search
  20. '?' - Backward search
  21. 'n' - Repeat last search (forward)
  22. 'N' - Repeat last search (backward)
  23. The following is a sample text file:
  24. EOF
  25. TEXT=/usr/share/common-licenses/GPL
  26. test -f $TEXT || TEXT=../COPYING
  27. cat $TEXT | expand >> $tempfile
  28. $DIALOG --clear --title "TEXT BOX" "$@" --textbox "$tempfile" 0 0
  29. retval=$?
  30. . ./report-button