Tagged Questions
3
votes
2answers
134 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
267 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]. ...