Re: add custom environment variable in bash source code
From:
Alex fxmbsw7 Ratchev
Subject:
Re: add custom environment variable in bash source code
Date:
Thu, 18 Aug 2022 04:12:57 +0200
On Thu, Aug 18, 2022, 04:10 Dale R. Worley <worley@alum.mit.edu> wrote:
> 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
>
i think they mean android nonroot default
fyi asker termux does just change #! to its android path
>