This script will give you a string of random quaternary sequence for a given length.
#!/bin/bash
# This needs an argument of length.
if [ $1"blah" == "blah" ]; then
echo An argument of string length is required.
exit 1
fi
# croaks and dies if any uninitiated variable is used.
set -u
mynum=$(echo "4^$1-1"|bc)
if [ -e /usr/bin/jot ]; then
SEQ="jot"
else
echo "FAIL"; exit
fi
$SEQ 0 $mynum | awk -v mylen=$1 '{
j=0;
t=$1;
mystr="";
while(j<mylen){
if(t%4==0){
mystr="A"mystr;
}else if(t%4==1){
mystr="T"mystr;
}else if(t%4==2){
mystr="C"mystr;
}else if(t%4==3){
mystr="G"mystr;
}
t=int(t/4);
j=j+1;
}
printf("%s\n",mystr)
}'