clear
while true
do
clear
echo "Enter your Input Base"
echo "(Binary-2)\n(Octal-8)\n(Decimal-10)\n(Hexa-Decimal-16)"
read ib
echo "Enter number you want to convert"
read num
echo "Enter your output Base"
echo "(Binary-2)\n(Octal-8)\n(Decimal-10)\n(Hexa-Decimal-16)"
read ob
ans=$(echo "obase=$ob;ibase=$ib;$num" | bc)
echo $ans
echo "Do you want to run again?(y/n)"
read ch
if [ $ch = "n" ]
then
break
fi
done
Home » Unix » shell script » write a shell script for number System[Decimal , Binary ,Octal , Hexadecimal]
[…] write a shell script for number system[Binary,Decimal,Octal,Hexadecimal]. […]