bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: add custom environment variable in bash source code


From: Dale R. Worley
Subject: Re: add custom environment variable in bash source code
Date: Wed, 17 Aug 2022 22:09:54 -0400

Sam <sam@cmpct.info> writes:
> You probably want to edit /etc/ld.so.conf or /etc/ld.so.conf.d/* instead.

The overall concept is that you almost certainly don't want to modify
the bash source code (and thus executable) to do this.

In general, if you want to have a particular environment variable set
"all the time", you insert "export X=..." in one of your startup files.
If you want it visible to everybody, you insert that in one of the
system startup files.  Depending on exactly what processes you want
affected and how your OS handles these things determines which file to
modify.

However, the original question is

> I want to automatically add LD_PRELOAD before starting bash to make
> this dynamic library work

I see looking at the ld.so manual page:

       /etc/ld.so.preload
              File  containing  a  whitespace-separated  list  of  ELF  shared
              libraries to be loaded before the program.

So if what you want is for all processes to preload a particular
library, add its name to this file.  Or rather, check how your
particular OS provides this facility.

Dale



reply via email to

[Prev in Thread] Current Thread [Next in Thread]