For one user account, I want to have some bash scripts, which of course would be under version control.

The obvious solution is just to put the scripts in a git repository and make ~/bin a symlink to the scripts directory.

Now, it seems on systemd systems ~/.local/bin is supposedly the directory for user scripts.

My question, is mostly, what are the tradeoffs between using ~/bin and ~/.local/bin as directory for my own bash scripts?

One simple scenario I can come up with are 3rd party programs which might modify ~/.local/bin and put their own scripts/starters there, similar to 3rd party applications which put their *.desktop files in ~/.local/applications.

Any advice on this? Is ~/.local/bin safe to use for my scripts or should I stick to the classic ~/bin? Anyone has a better convention?

(Btw.: I am running Debian everywhere, so I do not worry about portability to non systemd Linux systems.)

Solved: Thanks a lot for all the feedback and answering my questions! I’ll settle with having my bash scripts somewhere under ~/my_git_monorepo and linking them to ~/.local/bin to stick to the XDG standard.

  • sunshine@lemmy.ml
    link
    fedilink
    arrow-up
    2
    ·
    9 days ago

    I migrated to fish recently and at first I was really annoyed that I had to decompose my ~/.bash_aliases into 67 different script files inside ~/.config/fish/functions/, but (a) I was really impressed with the tools that fish gave me to quickly craft those script files (-

    ~> function serg
        sed -i -e "s/$1/$2/g" $(rg -l "$1")
    end
    ~> funcsave serg
    funcsave: wrote ~/.config/fish/functions/serg.fish
    

    ) - and (b) I realized it was something I ought to have done a while ago anyway.

    Anyway, all this to say that fish ships with a lot of cool, sensible & interesting features, and one of those features is a built-in place for where your user scripts should live. (Mine is a symlink to ~/Dropbox/config/fish_functions so that I don’t need to migrate them across computers).

    • wolf@lemmy.zipOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      7 days ago

      Nice! Thanks for chiming in with how Fish does it, sounds like a really great idea to have functions in ~/.config/fish/functions!