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.

  • Max-P
    link
    fedilink
    314 days ago

    Another reason to use ~/.local is you can do things like

    ./configure --prefix=$HOME/.local
    make -j$(ncpu)
    make install
    

    And then you get your .local/bin, .local/share, .local/include, .local/lib and such, just like /usr but scoped to your user.

    and it should mostly just work as well.

    • Akatsuki Levi
      link
      fedilink
      English
      84 days ago

      And if there’s other users in the machine, it doesn’t fuck things up for others Or if it ends up messing something up, it is user-scoped, so its a lot easier to fix than a bricked system