You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This may be the same bug as #5 and I think I have found a fix.... but it's possible they are distinct.
./main.sh -f foo -t should populate arg_t with the value parsed from the usage string default. However, opt is set to ?, the help function is called and getopts aborts.
OK, after more investigation, I have determined I might be overthinking things here... I think the behavior is currently correct. Double checking, and will reopen if I find otherwise.
👏 Glad to hear it. That makes sense because I haven't observed any problematic behaviors recently except on occasion when I deviated from the expected syntax of the usage line. Unfortunately, I didn't write down the details of what those deviations were, but in every case, I was able to edit the line and get behavior that seemed non-problematic to me.
This may be the same bug as #5 and I think I have found a fix.... but it's possible they are distinct.
./main.sh -f foo -t
should populatearg_t
with the value parsed from the usage string default. However,opt
is set to?
, thehelp
function is called andgetopts
aborts.As detailed on this SO post you can actually put
getopts
into silent mode an explicitly test for missing option arguments. Here is some more info from bash hackers wiki: http://wiki.bash-hackers.org/howto/getopts_tutorial#error_reportingThis technique will allow b3bp to not barf when optional option arguments are missing.
The text was updated successfully, but these errors were encountered: