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

14
src_files/.local/scripts/gfind Executable file
View File

@@ -0,0 +1,14 @@
#! /bin/zsh
# simple wrapper to run both find and grep
# usage: gfind <search-term> [search-directory]
# if no search-directory given, uses . by default
searchTerm=$1
searchDirectory=$(if [[ -n $2 ]] then echo $2; else echo "."; fi)
printf '//// find results for: %s in directory: %s\n' $searchTerm $searchDirectory
find $searchDirectory -iname "*$searchTerm*"
printf '\n//// grep results for: %s in directory: %s\n' $searchTerm $searchDirectory
grep -rIi $searchTerm $searchDirectory