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.

  • phantomwise@lemmy.ml
    link
    fedilink
    arrow-up
    3
    ·
    18 hours ago

    Personally I put scripts in ~/.local/bin/scripts/ instead of just ~/.local/bin/ because I like to keep them separate from other binaries. To note: even though ~/.local/bin/ is in PATH, it’s subfolders are not, so if you do that you need to add the scripts subfolder to PATH if you want to run the scripts directly.

    Well actually my scripts are in mydotfilesrepo/home/.local/bin/scripts, and I use GNU Stow to symlink mydotfilesrepo/home to /home/myuser/ (same for mydotfilesrepo/etc/ and mydotfilesrepo/usr/ which are symlinked to /etc and /usr), but it’s the same result. Stow is pretty cool for centralizing your configs and scripts in one repo !

    I’ve never seen ~/bin before so I can’t comment on whether it’s a good idea.

    • steeznson@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      12 hours ago

      I dislike having top-level directories in $HOME that aren’t storing media or documents. Some linux ports of games are awful for littering your homedir or Documents. Just lazy devs. Put it all in ~/.local please folks!