News for hackers. Stuff that matters.
Re:Minimal safe Bash script template by kps on Tuesday December 15, 2020 @09:59AM (#25430862)
It's too bad (for bash users) that bash never bothered to embrace ksh getopts. The equivalent of the article's two pages is roughly,

    usage=$'
      [-1][+NAME?script - Script synopsis here]
      [f:flag?Some flag description]
      [p:param?Some param description]:[string?description]
    '
    while getopts "$usage" opt
    do
      typeset opt_${opt}=${OPTARG:-1}
    done

There are no comments on this comment yet.