Skip to content

Instantly share code, notes, and snippets.

@aschwinwester
Created October 28, 2020 19:51
Show Gist options
  • Select an option

  • Save aschwinwester/b998959a4a0523525d41ef057562800d to your computer and use it in GitHub Desktop.

Select an option

Save aschwinwester/b998959a4a0523525d41ef057562800d to your computer and use it in GitHub Desktop.

Revisions

  1. aschwinwester created this gist Oct 28, 2020.
    49 changes: 49 additions & 0 deletions bash-flags.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,49 @@
    ```
    while test $# -gt 0; do
    case "$1" in
    -h|--help)
    echo "$package - attempt to capture frames"
    echo " "
    echo "$package [options] application [arguments]"
    echo " "
    echo "options:"
    echo "-h, --help show brief help"
    echo "-a, --action=ACTION specify an action to use"
    echo "-o, --output-dir=DIR specify a directory to store output in"
    exit 0
    ;;
    -a)
    shift
    if test $# -gt 0; then
    export PROCESS=$1
    else
    echo "no process specified"
    exit 1
    fi
    shift
    ;;
    --action*)
    export PROCESS=`echo $1 | sed -e 's/^[^=]*=//g'`
    shift
    ;;
    -o)
    shift
    if test $# -gt 0; then
    export OUTPUT=$1
    else
    echo "no output dir specified"
    exit 1
    fi
    shift
    ;;
    --output-dir*)
    export OUTPUT=`echo $1 | sed -e 's/^[^=]*=//g'`
    shift
    ;;
    *)
    break
    ;;
    esac
    done
    ```