bananacode/banana.sh
2021-03-07 23:55:48 +01:00

25 lines
492 B
Bash
Executable file

#!/bin/bash
num=$1
minlength=1
alphabets=(bcdfglmnprstvz aeiou)
numalpha=${#alphabets[@]}
v=$num
st=
length=0
idx=$((($numalpha - 1) % $numalpha))
while !( [ $v -eq 0 ] && [ $idx -eq $((($numalpha - 1) % $numalpha)) ] && [ $length -ge $minlength ] )
do
al=${alphabets[idx]}
r=$(($v % ${#al}))
v=$(($v / ${#al}))
st="${al:$r:1}$st"
idx=$((($idx + $numalpha - 1) % $numalpha))
length=$(($length + 1))
done
echo $st