#!/bin/bash
#########################################################
# 							#
# This is BashStyle-NG  				#
#							#
# Licensed under GNU GENERAL PUBLIC LICENSE v3    	#
#							#
# Copyright 2007 - 2018 Christopher Bratusek		#
#							#
#########################################################

case ${1} in

	cf | cel-fah)
		echo "scale=2; $1 * 1.8  + 32" | bc
	;;

	ck | cel-kel)
		echo "scale=2; $1 + 237.15" | bc
	;;

	fc | fah-cel)
		echo "scale=2 ; ( $1 - 32  ) / 1.8" | bc
	;;

	fk | fah-kel)
		echo "scale=2; ( $1 + 459.67 ) / 1.8 " | bc
	;;

	kc | kel-cel)
		echo "scale=2; $1 - 273.15" | bc
	;;

	kf | kel-fah)
		echo "scale=2; $1 * 1.8 - 459,67" | bc
	;;

	*)
		bashstyle-help -a "Christopher Roy Bratusek" -e "nano@jpberlin.de" -h "http://www.nanolx.org/"\
			-l "GNU GPL v3" -n "convtemp" -s "convert between °C, °F and °K" -v "${BSNG_VERSION}" -y "${BSNG_YEAR}"\
			-o "cf:number|convert °C to °F"\
			-o "ck:number|convert °C to °K"\
			-o "fc:number|convert °F to °C"\
			-o "fk:number|convert °F to °K"\
			-o "kc:number|convert °K to °C"\
			-o "kf:number|convert °K to °F"
	;;

esac
