home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / utils / shell / dialog-0.000 / dialog-0 / dialog-0.6c / samples / textbox < prev    next >
Encoding:
Text File  |  1995-08-07  |  1.1 KB  |  43 lines

  1. #!/bin/sh
  2. DIALOG=${DIALOG=../dialog}
  3.  
  4. cat << EOF > /tmp/textbox.tmp.$$
  5. Hi, this is a text dialog box. It can be used to display text from a file.
  6. The file should not contain any 'tab' characters, so you should 'expand'
  7. the file first if it contains 'tab' characters.
  8.  
  9. It's like a simple text file viewer, with these keys implemented:
  10.  
  11. PGDN/SPACE     - Move down one page
  12. PGUP/'b'       - Move up one page
  13. ENTER/DOWN/'j' - Move down one line
  14. UP/'k'         - Move up one line
  15. LEFT/'h'       - Scroll left
  16. RIGHT/'l'      - Scroll right
  17. '0'            - Move to beginning of line
  18. HOME/'g'       - Move to beginning of file
  19. END/'G'        - Move to end of file
  20. '/'            - Forward search
  21. '?'            - Backward search
  22. 'n'            - Repeat last search (forward)
  23. 'N'            - Repeat last search (backward)
  24.  
  25.  
  26. The following is a sample text file:
  27.  
  28.  
  29. EOF
  30.  
  31. cat ../COPYING | expand >> /tmp/textbox.tmp.$$
  32.  
  33. $DIALOG --clear --title "TEXT BOX" --textbox "/tmp/textbox.tmp.$$" 22 77
  34.  
  35. case $? in
  36.   0)
  37.     echo "OK";;
  38.   255)
  39.     echo "ESC pressed.";;
  40. esac
  41.  
  42. rm -f /tmp/textbox.tmp.$$
  43.