~skiqqy/bin

ref: e187890d770145f93f1239f3a4d13d4770141c0e bin/binary -rwxr-xr-x 207 bytes
e187890dStephen Cochrane Changed echo to no op 1 year, 1 month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
#!/bin/bash
isnum() { awk -v a="$1" 'BEGIN {print (a == a + 0)}' >/dev/null; }

toBinary(){
	local n bit
	for (( n=$1 ; n>0 ; n >>= 1 )); do  bit="$(( n&1 ))$bit"; done
		printf "%s\n" "$bit"
}

toBinary $1