There are bunch of tools under Solaris systems that make your coding life easier, if you find yourself keep writing the same code over and over again in your scripst you might want to look at these tools. In my Openindiana 151a System, I have the following
ckdate ckint ckkeywd ckrange cksum ckuid
ckgid ckitem ckpath ckstr cktime ckyorn
So let’s take ckyorn for example. It let’s you answer a question with yes or no, it looks like following if you just execute it:
Yes or No [y,n,?,q] a
ERROR: Please enter yes or no.
Yes or No [y,n,?,q] n
You can utilize this maybe under bash something like this:
myanswer=`ckyorn -p “Are you 21 or older?”`
if [ $myanswer == “n” ]
then echo “you can’t buy alcohol!”
Which when executed:
Are you 21 or older? [y,n,?,q] n
you can’t buy alcohol
These are very useful tools and you can find more information in the man pages.