A function that accepts named parameters
suggest changefoo() {
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
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents