Adjust launch-reaper scripts a bit, also add two general scripts

This commit is contained in:
2025-10-05 15:08:29 -05:00
parent 1be24fa795
commit f82a7c4c71
6 changed files with 72 additions and 24 deletions

View File

@@ -0,0 +1,33 @@
#! /bin/zsh
# simple unit-conversion util, partly made for fun, not much here so far
conversionUnits=$1
inputsToConvert=($argv[2,-1])
function cmToIn() {
result=$(( 1 / 2.54 * $1 ))
printf '%.1f cm => %.2f in\n' $1 $result
}
function inToCm() {
result=$(( 2.54 * $1 ))
printf '%.2f in => %.1f cm\n' $1 $result
}
function unsupportedUnits() {
echo "unsupported conversion units given: $conversionUnits"
exit 1
}
funcRef=exit # not sure what a good default function is, using exit
case $conversionUnits in
(cm|cm-in) funcRef=cmToIn
;;
(in|in-cm) funcRef=inToCm
;;
(*) funcRef=unsupportedUnits
;;
esac
for i in $inputsToConvert; do $funcRef $i; done