daily pastebin goal
13%
SHARE
TWEET

decimal2base12.sh

h8rt3rmin8r Jan 2nd, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! /bin/bash
  2. # BASE 12 - DECIMAL INPUT CONVERSION SCRIPT
  3.  
  4. function decimal2base12() {
  5.     number=$(echo "$1" | tr -s '[:lower:]' '[:upper:]' )
  6.     result=$(echo "obase=$obase;ibase=$ibase;$number" | bc)
  7.     if [ ! "$?" == "0" ]; then echo ""; exit 1; fi
  8.     echo "$result"
  9. }
  10.  
  11. obase=12; ibase=10; decimal2base12 "$1"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top