Welcome to Machine Unix

Search Below

Solaris ck* Tools

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

root@oi151a:~/Proj# ck
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:

root@oi151a:~/Proj# ckyorn

Yes or No [y,n,?,q] a
ERROR: Please enter yes or no.

Yes or No [y,n,?,q] n
n
root@oi151a:~/Proj#

You can utilize this maybe under bash something like this:

#!/usr/bin/bash

myanswer=`ckyorn -p “Are you 21 or older?”`

if [ $myanswer == “n” ]
then echo “you can’t buy alcohol!”
else
echo “…..”
fi

Which when executed:

root@oi151a:~/Proj# ./myscript

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.