diff options
author | johannst <johannes.stoelp@gmail.com> | 2021-01-20 20:15:00 +0100 |
---|---|---|
committer | johannst <johannes.stoelp@gmail.com> | 2021-01-20 20:15:00 +0100 |
commit | 77d44129ad468581e860720ccdb7643d5bb25601 (patch) | |
tree | 2ccf8205802f0998deb44b9011acdacf6ecd3fca /src/tools | |
parent | 836b1874369fa47f37a71f2f04af18e7929567ce (diff) | |
download | notes-77d44129ad468581e860720ccdb7643d5bb25601.tar.gz notes-77d44129ad468581e860720ccdb7643d5bb25601.zip |
fixed whitespaces in bash notes
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/bash.md | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/tools/bash.md b/src/tools/bash.md index 15f455a..6217e8f 100644 --- a/src/tools/bash.md +++ b/src/tools/bash.md @@ -106,7 +106,7 @@ command 2>&1 >file The `getopts` builtin uses following global variables: - `OPTARG`, value of last option argument - `OPTIND`, index of the next argument to process (user must reset) -- `OPTERR`, display errors if set to `1` +- `OPTERR`, display errors if set to `1` ```bash getopts <optstring> <param> [<args>] @@ -121,15 +121,15 @@ getopts <optstring> <param> [<args>] ```bash #!/bin/bash function parse_args() { - while getopts "f:c" PARAM; do - case $PARAM in - f) echo "GOT -f $OPTARG";; - c) echo "GOT -c";; - *) echo "ERR: print usage"; exit 1;; - esac - done - # users responsibility to reset OPTIND - OPTIND=0 + while getopts "f:c" PARAM; do + case $PARAM in + f) echo "GOT -f $OPTARG";; + c) echo "GOT -c";; + *) echo "ERR: print usage"; exit 1;; + esac + done + # users responsibility to reset OPTIND + OPTIND=0 } parse_args -f xxx -c |