#!/bin/sh # https://stackoverflow.com/questions/7253235/convert-hexadecimal-color-to-decimal-rgb-values-in-unix-shell-script/7253786#7253786 hexinput="$(echo $1 | tr '[:lower:]' '[:upper:]')" # uppercase-ing a=`echo $hexinput | cut -c-2` b=`echo $hexinput | cut -c3-4` c=`echo $hexinput | cut -c5-6` r=`echo "ibase=16; $a" | bc` g=`echo "ibase=16; $b" | bc` b=`echo "ibase=16; $c" | bc` echo $r $g $b exit 0