A function that accepts named parameters

suggest change
foo() {
  while [[ "$#" -gt 0 ]]
  do
    case $1 in
      -f|--follow)
        local FOLLOW="following"
        ;;
      -t|--tail)
        local TAIL="tail=$2"
        ;;
    esac
    shift
  done

  echo "FOLLOW: $FOLLOW"
  echo "TAIL: $TAIL"
}

Example usage:

foo -f
foo -t 10
foo -f --tail 10
foo --follow --tail 10

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents