summaryrefslogtreecommitdiff
path: root/localless
blob: 773f7a5da07c35979a52fd052d5368d00120c7ed (plain)
  1. #!/bin/sh
  2. #
  3. # Copyright © 2021 Jonas Smedegaard <dr@jones.dk>
  4. # Description: pipe a command to less with INT signal blocked
  5. #
  6. # This program is free software;
  7. # you can redistribute it and/or modify it
  8. # under the terms of the GNU General Public License
  9. # as published by the Free Software Foundation;
  10. # either version 2, or (at your option) any later version.
  11. #
  12. # Thanks to Jakub Wilk <jwilk@debian.org> for the trick
  13. #
  14. # Depends: less
  15. set -e
  16. PRG=$(basename "$0")
  17. showhelp() {
  18. cat <<EOF
  19. Usage: $PRG command [opetions...]
  20. Example: $PRG journalctl -ef
  21. EOF
  22. }
  23. exit1() {
  24. echo "ERROR: $1"
  25. exit 1
  26. }
  27. if [ $# -eq 0 ]; then
  28. showhelp
  29. exit1 "not enough parameters"
  30. fi
  31. exec env --ignore-signal=INT "$@" | less