#!/bin/bash function dec2bin() { n=$1 r= while [ $n != 0 ]; do r="$(($n%2))$r" n=$(($n/2)) done [ -z "$r" ] && r=0 echo $r } dec2bin 129