1

I have a number of self-written scripts on my PC. I want to put these in the correct spot in my homedir according to the XDG Basedir spec. But I also want to backup these scripts in an clear and scalable manner.

The XDG Basedir spec mentions the following:

User-specific executable files may be stored in $HOME/.local/bin. Distributions should ensure this directory shows up in the UNIX $PATH environment variable, at an appropriate place.

So I would put my scripts in $HOME/.local/bin. But this directory is also populated with other script that were installed through a package manager (e.g. python pip). So backing up only my scrips isn't tivial (neither using a git repo, nor by explicitly copying them to a remote location).

I have currently put my scripts in a subfolder from $HOME/.local/bin, but $PATH doesn't look in the directories recursively, so I have to explicitly add the subfolder to my $PATH, which also seems somewhat unnecessary.

Is there a different location where I could put my scripts? Or should I handle this in a different way altogether?

2 Answers 2

2

The way I handle this is to keep my scripts in separate project directories, e.g. at its most basic something like ~/scripts. This directory is a git repository, so I can keep notes on changes, and push it elsewhere if I want to. I then create symbolic links to the scripts I need in ~/.local/bin.

1

The answer to the question in the title is "the XDG Base Directory Specification doesn't say". The answer to the question(s) in the body is "you're free to do what works for you".

My understanding of the XDG Base Directory Specification is that it is for Linux programmers and for developers/maintainers of Linux distributions, not for users. The point is to assure a better experience for end users, not to dictate to end users what must happen with their home directories.

I jump through a few hoops to assure that the programs I install comply with the spec: environment variables, aliases, config files, etc. The Arch Wiki is profoundly useful in this endeavor. But all the scripts I write and most of the little single-file utilities I grab from here and from github/gitlab go in ~/bin.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.