~skiqqy/bin

ref: 3c0ea9d1382310297caced4fd4804dbbbb47ce66 bin/binary -rwxr-xr-x 207 bytes
3c0ea9d1Stephen Cochrane Added touch on start 7 months 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