-- Leo's gemini proxy

-- Connecting to idiomdrottning.org:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini; lang=en

Re: The Linux shell is not a good automation platform


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.


Follow-Up


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.

-- Response ended

-- Page fetched on Fri Mar 29 02:20:55 2024