~skiqqy/bin

ref: aac55bff5398dd39a0048bfcb48a4ecf70e1f775 bin/binary -rwxr-xr-x 207 bytes
aac55bffStephen Cochrane Added my goto script 1 year, 6 days 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