2

Where do I find a list of well-known environment variables?

Background

I am writing a script that will start a video player. So I am looking for the environment variable analogous to $EDITOR/$PDFVIEWER but for video player, so that my tool will start the video player that is preferred by the user.

So environment variables that are used by software installed on a high portion of software and that are not only used by that particular single piece of software.

Ole Tange
  • 35,514
  • Run set and read help set – ajeh May 10 '18 at 14:53
  • By "well-known" do you mean recognized or provided by the shell? Or specifically by Bash? ($PDFVIEWER does not satisfy those characterizations, but then again, I wouldn't consider it "well-known".) Otherwise, I'm not sure any such thing exists. – John Bollinger May 10 '18 at 14:54
  • 1
    That's not answerable as written. Every application and possibly library they use will have variables they use. Most of the time that's documented in the application's manual. For libraries (like the dynamic linker, libc, libssl), you may need to have a look at developer documentation. – Stéphane Chazelas May 10 '18 at 15:20
  • @StéphaneChazelas It is answerable, if there exists a website with a list of well-known environment variables. This would probably include environment variables used by the software installed on a high portion of UNIX-machines. – Ole Tange May 10 '18 at 16:05
  • @ajeh set only include environment variables that are set. I am looking for variables that I may not be aware of is used by commonly used software. – Ole Tange May 10 '18 at 16:06
  • if they are not set, you don't need them 2) if they are not set, set your own as you wish 3) sounds like you are solutionizing something before defining the problem
  • – ajeh May 10 '18 at 16:09
  • @ajeh I have tried elaborating the background: It is not for me, it is for the users of my software. The users are not known to me, but can be anywhere in the world. – Ole Tange May 10 '18 at 16:11
  • Not much of an answer, so: consider documenting a variable of your own choosing that could define the user’s preference. If it’s unset (or unusable), fall back to whatever you’re doing now. – Jeff Schaller May 10 '18 at 16:33
  • What you want is a command called xdg-open, not an environment variable. That pulls configuration from somewhere in ~/.config or ~/.local/share, but I don't remember where. – Austin Hemmelgarn May 10 '18 at 19:37