This question already has an answer here:
What is the best way to parse parameters in shell script command, and then validate it?
For example bash someScript.sh -p <some_path> -o <some_other_param> -i (User forget to provide value)
.
How to parse all of this parameters and when user forget to input some parameters or value of this parameter show some error message and terminate executing of script?
Use getopt or getopts.
There are lots of examples on this site, but here is one more:
Of course, the
man
page is always a good resource. But there are also good examples on the net. When dealing withgetopts
, I always refer to http://mywiki.wooledge.org/BashFAQ/035. Pretty much everything you'd want to know can be found there.Search man pages of
getopts
. You would easily implement it.