Summary
In this chapter, we’ve looked at getopts
, which gives us a cool and easy way to create scripts that recognize Linux and Unix-style option switches that might have their own arguments. We began with a review of what command options and arguments are, and then cleared up a possible point of confusion about getopt
and getopts
. After a presentation about how to use getopts
, we wrapped up with a review of a couple of real-world scripts that use it.
In the next chapter, we’ll look at how shell scripting can be a big help to security professionals. I’ll see you there.