Echo

From CleanPosts

Jump to: navigation, search

Convert decimal to 16 bit binary and trim leading zeros

#! /bin/bash
D2B=({0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1})
echo $((10#${D2B[$1]}))

Use the command line as a quick calculator

echo $((145+5))
echo $((145-5))
echo $((145*5))
echo $((145/5))
echo $((145%5))
echo $((145**5))
Personal tools
Strangers In Paradise