mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
310 B

  1. #!/bin/sh
  2. m=10
  3. useage () {
  4. echo "Usage: head [OPTION]... [FILE]..."
  5. echo -e "\t-n,-[0-9]+\tprint first NUMBER lines instead of first 10"
  6. exit 1
  7. }
  8. while [ "$1" ] ; do
  9. case "$1" in
  10. -n) m="$2" ; shift ; shift ;;
  11. -[0-9]*) m=${1#-}; shift ;;
  12. -*) useage ;;
  13. *) break;
  14. esac
  15. done
  16. exec grep -m$m "" $*