I prefer bit-bashing to string-bashing. Whatever floats your boat.
printf '%0*b', $bits, $num & ((1<<$bits)-1)In reply to Re: Converting negative number to binary with specific width
by Anonymous Monk
in thread Converting negative number to binary with specific width
by pjkang7
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |