š¾ Archived View for idiomdrottning.org āŗ re-shell-automation captured on 2024-08-25 at 00:59:09. Gemini links have been rewritten to link to archived content
ā¬ ļø Previous capture (2024-02-05)
-=-=-=-=-=-=-
Re: The Linux shell is not a good automation platform
Unless you 100% use command line utilities
Wellā¦ thatās the solution right thereā„ļø
Shell can read the clipboard with xclip and you can make shell scripts that are emacs-aware with emacsclient -e.
You can run shell scripts from your dwm / sway or from emacs or from your other apps.
I currently have over 320 custom shell functions and around 200 standalone homemade scripts and binaries. Kind of beyond what I think most people have in their Tasker setups.
Iāve gradually over the past 20 years built up this disgusting palimpsest of scripts upon scripts upon scripts. My lisp shells out and my shell calls lisp and vice versa recursively. Itās completely gross.
Kensanata wrote in:
When you posted about the number of shell scripts and aliases a while back, you beat me by factor of 100, more or less. I donāt think I ever used cal in a script! š
I was really bitten by that actually, once. I didnāt think of the ājust type the actual pathā thing, which has saved me on other occasions since.
Yeah, I source, letās see now: currently 1595 lines of functions and aliases into every shell I open. Thatās in addition to hashbang scripts and binaries. Of course, they all call each other in a huge mess. My Chicken Scheme programs and my Emacs Lisp commands call shell script functions and vice versa.
I have a command called zshrun for when I need to use this stuff externally, from cron, from posix scripts, from Chicken, from Emacs. Itās simply this:
ellen% cat /usr/local/bin/zshrun #!/usr/bin/zsh source /home/sandra/.zshrc $*
From zsh itās easy to call emacs stuff:
ellen% which emx emx () { for command in $* do emacsclient -n -e "($command)" done }
And of course to call my liāl Chicken utils, theyāre just binaries.
dc is a language I use very often but they are not convient to make into hashbangs. Instead, I do things like this:
ellen% which fcp fcp () { dc -e "$* 4*sp4*sc9*sflplclf++st[Fat: ]Plf100*lt/n[%]p[Carbs: ]Plc100*lt/n[%]p[Protein: ]Plp100*lt/n[%]p" }
As in, shell functions that just call dc -e āsome stringā and that string is interpolated to contain the function args.