Gnu World Order

gnuWorldOrder_13x12

Informações:

Sinopsis

The journey through the **util-linux** from the **a** package set of Slackware continues. First, a tutorial on `getopt`, an argument parser for Bash and Tcsh. Here is a demonstrative sample script: #!/usr/bin/bash ## or you can just use /bin/sh OPTS=`getopt --options f --long foo --alternative -- "$@"` eval set -- "$OPTS" echo "Raw input: $OPTS" while true ; do case "$1" in -f|--foo) echo "Option f has been toggled on" ; shift ;; --) shift ; break ;; esac done # this outputs anything # left over after parsing # valid options for i in "$@" ; do echo "$i" done You can add more options, and you can add an allowance for arguments. Here is a slightly more complex version of the script: #!/usr/bin/bash OPTS=`getopt --options f,b: --long foo,bar: --alternative -- "$@"` eval set -- "$OPTS" echo "$OPTS" while true ; do case "$1" in