3
votes
2answers
212 views

how to make getopts just read the first character post `-`

I have a shell script testShell.sh which uses getopts as below: #!/bin/bash while getopts ":j:e:" option; do case "$option" in j) MYHOSTNAME=$OPTARG ;; e) SCRIPT_PATH=$OPTARG ;; ...
3
votes
2answers
458 views

Getopts option processing, Is it possible to add a non hyphenated [FILE]?

I'm using getopts for all of my scripts that require advanced option parsing, and It's worked great with dash. I'm familiar with the standard basic getopts usage, consisting of [-x] and [-x OPTION]. ...