summaryrefslogtreecommitdiff
path: root/home/xyz/.local/bin/il
blob: 7c75a71093ea7767921a17705fc4c04f0c8eefd1 (plain)
1
2
3
4
5
6
#!/bin/sh
# InterpoLation

# x=$1, xa=$2, xb=$3, ya=$4, yb=$5
# https://en.wikipedia.org/wiki/Interpolation#Linear_interpolation
echo "scale=4;$4+($5-$4)*($1-$2)/($3-$2)" | bc
n class="hl opt">:T: opt; do case $opt in c) tz_from="Asia/Shanghai";; f) tz_from="$(tzselect)";; F) tz_from="$OPTARG";; # one extra ',' at the end will not let `for tz in ...` loop one extra time? t) for i in $(seq "$OPTARG"); do tz_to="$(tzselect),$tz_to" done;; T) tz_to="$OPTARG,$tz_to";; \?) exit 1;; esac done shift $((OPTIND-1))