Article 54NDX zparseopts - How to make an option (not argument of the option) mandatory

zparseopts - How to make an option (not argument of the option) mandatory

by
blueray
from LinuxQuestions.org on (#54NDX)
In The example bellow:
Code:function zp () {
zparseopts -E -walk:=o_walk
echo "walk: $o_walk"
}I get the follwing output.
Code:$ zp --walk "Walking"
walk : --walk Walking
$ zp --walk
zp:zparseopts:2: missing argument for option: -walk
walk :Here the argument of the option is mandatory so I am getting this error.

How can I make the option mandatory so that I must pass --walk to zp else it will throw an error.latest?d=yIl2AUoC8zA latest?i=DYdbM0x_q90:jtPO_xsesxQ:F7zBnMy latest?i=DYdbM0x_q90:jtPO_xsesxQ:V_sGLiP latest?d=qj6IDK7rITs latest?i=DYdbM0x_q90:jtPO_xsesxQ:gIN9vFwDYdbM0x_q90
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments