• 0 Posts
  • 10 Comments
Joined 1 month ago
cake
Cake day: December 16th, 2024

help-circle


  • Yeah, another way to do it is

    #!/bin/bash
    set -euo pipefail
    
    if [[ $# -lt 1 ]]
    then
      echo "Usage: $0 argument1" >&2
      exit 1
    fi
    

    i.e. just count arguments. Related, fish has kind of the orthogonal situation here, where you can name arguments in a better way, but there’s no set -u

    function foo --argument-names bar
      ...
    end
    

    in the end my conclusion is that argument handling in shells is generally bad. Add in historic workarounds like if [ "x" = "x$1" ] and it’s clear shells have always been Shortcut City


    Side note: One point I have to award to Perl for using eq/lt/gt/etc for string comparisons and ==/</> for numeric comparisons. In shells it’s reversed for some reason? The absolute state of things when I can point to Perl as an example of something that did it better





  • I suspect my habit of having an alias userctl="systemctl --user" is slightly unusual, as is running Firefox, Steam, and some other graphical programs as systemd units is somewhat unusual (e.g. mod4-enter runs systemd-run --user alacritty)

    But what I’m actually pretty sure is unique is my keyboard layout. I taught myself dvorak a summer some decades ago, but the norwegian dvorak layout has some annoyances, so I’ve made some tweaks. Used to be a Xmodmap file, but with the switch to wayland I turned it into a file in /usr/share/X11/xkb/symbols/.

    Part of what I did to teach myself dvorak and touch-typing at the same time was randomize the placement of the keycaps too. It has a side effect of being a kind of security by obscurity layer: I type quickly and confidently, but others who want to use my machines have an “uhh …” reaction.



  • Yeah, the manpages for systemd are large but also informative. Most of us only use a small subset of the features—much like we never explored everything possible with separate init programs.

    Having used Linux on the desktop for some two decades and worked as a Linux sysadmin for a good while I don’t miss the init scripts. My impression is more that a certain cohort wants to pretend that service management is easy by ignoring large amounts of it. It’s easy to write a bad init script that breaks when you really need it, or be out of your depth with more complex cases.

    Not to mention the whole conformity by convention thing. Systemd unit files are descriptive and predictable by their nature. So-called init scripts didn’t really have to be scripts, they just usually were, and their arguments and output and behaviour was also unenforced—there’s nothing really stopping you from writing a compiled program that self-daemonizes and place the binary with the init scripts rather than in /bin. Ultimately people who make programs also have to be good at writing init programs with that setup.

    So we’d have people doing dumb shit themselves and getting angry at others doing dumb shit. PHP was also pretty popular and full of dumb shit. Lots of “worse is better” to go around.

    Ultimately it’s more of the stuff covered in Bryan Cantrill’s Platform as a reflection of values. Some of us value predictability and correctness, others feel it’s a straitjacket. There’s no way of pleasing everyone with the same platform.

    And currently the people who want to distribute their own riced-out init programs in bash, perl, php, node.js and so on are SOL. (They can still use them on their own machines.)