if statement - How to use options in bash for skipping parts of code -
I have a bidding script and I want to be able to leave it (which - is not executed) / P>
To make it clear what I want to accomplish, I have given the statement no arguments are passed when using the script, then executing all four and And as a result, print only I know I can use the I code with the following algorithm: if which basically fulfills the same thing.
<["$ 1"! = "SkipB"] then ["$ 1"!] = "SkipC"] then "" 1 "C" Fi if ["$ 1"! = "SkipD"] then "D" file resonance
echo statements Are there. If I want to leave one of those echo statements, then I use the
skipLETTER as the first code:
. All letters are printed except /script.sh skipA
A . It works, but it has many limitations - for one, I can not leave many parts using the same logic (
$ 1 ). I want to achieve the same thing with the options, so I can write something like this:
./ script - skipA -skipD
B and
C letters.
getopt or
getopts to get it, but I can not find any simple usage example I've received.
Comments
Post a Comment