<?xml version='1.0'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:atom="http://www.w3.org/2005/Atom" >
<channel>
	<title><![CDATA[BOL: Bash script for getopts]]></title>
	<link>https://bioinformaticsonline.com/snippets/view/43412/bash-script-for-getopts?</link>
	<atom:link href="https://bioinformaticsonline.com/snippets/view/43412/bash-script-for-getopts?" rel="self" type="application/rss+xml" />
	<description><![CDATA[]]></description>
	
	<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/snippets/view/43412/bash-script-for-getopts</guid>
	<pubDate>Wed, 29 Sep 2021 04:53:14 -0500</pubDate>
	<link>https://bioinformaticsonline.com/snippets/view/43412/bash-script-for-getopts</link>
	<title><![CDATA[Bash script for getopts]]></title>
	<description><![CDATA[<code>#using : after a switch variable means it requires some input (ie, t: requires something after t to validate while h requires nothing.
while getopts “ht:r:p:v” OPTION
do
     case $OPTION in
         h)
             usage
             exit 1
             ;;
         t)
             TEST=$OPTARG
             ;;
         r)
             SERVER=$OPTARG
             ;;
         p)
             PASSWD=$OPTARG
             ;;
         v)
             VERBOSE=1
             ;;
         ?)
             usage
             exit
             ;;
     esac
done

if [[ -z $TEST ]] || [[ -z $SERVER ]] || [[ -z $PASSWD ]]
then
     usage
     exit 1
fi</code>]]></description>
	<dc:creator>Surabhi Chaudhary</dc:creator>
</item>

</channel>
</rss>