Can I use getopts for parsing command-line arguments in my bash scripts(not sh) without worrying about another depedency?
Is getopts always available for Bash?
bash;portability
$ type getoptsgetopts is a shell builtingetopts is built in, so it's present anywhere bash is.To be sure of that you'd need to check the bash documentation to see whether it's an optional feature  it isn't.More precisely, this tells you that getopts is available in this particular version of bash. You need to check the release notes for older versions to see when getopts was introduced; that happened before the dawn of time (it was already present in bash 1.14 and you'd have a hard time finding a version that old).Even better, you can count on getopts even in shells that aren't bash, since it's required by POSIX.