I’ve done something similiar to this over the years for organization purposes and not having to change much between shells except add a path. You can also add cases that check your shell and do something slightly different if needed.

    • Ricaz@lemmy.dbzer0.com
      link
      fedilink
      English
      arrow-up
      0
      ·
      21 hours ago

      I agree. My .zshrc is littered with functions. Most useful ones are my pack and extract I made ~10 years ago, they just recognize file extension and use the correct tool.

      • PseudoSpock@lemmy.dbzer0.com
        link
        fedilink
        arrow-up
        0
        ·
        21 hours ago

        I even wrote a function to parse a json for some configuration details, and loop through it to dynamically create more named functions from that json profile. I use it at work for automating my cloud account logins with a single profile name from the command line. :)