0

Couldn't there be a config text file instead?

3 Answers 3

6

The PATH variable is used in lots of operations, reading it from a file would have a huge cost. And because every process has its own environmental variables it would mean one file for every process. It is easy to see why it is not stored on the drive.

4

PATH is an environmental variable in Linux and other Unix-like operating systems that tells the shell which directories to search for executable files. Environmental variables are a class of variables that tell the shell how to behave as the user works at the command line or with shell scripts.

In this way, PATH variable can be changed relatively easily and you can make a lot of operations easily with it. But, if you use instead a config text file for PATH, I think that all these easily things will become a headache.

Anyway, you can set PATH as you wish in a config/initialization file like ~/.profile.

0

I for instance have my own directory of scripts, under my home $HOME/.scripts where I can put some executables. Since I also added this directory to the $PATH variable, I can call any of my scripts just by the filename, without using the whole route the scripts are stored.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .