LD_LIBRARY_PATH without export

2019-08-09 02:50发布

问题:

I'm trying to run a program on a remote system on which I can't set environment variables (no access to export). The problem I'm having is I can't set LD_LIBRARY_PATH to run my binary because I don't have (and can't get) permission.

I need a quick fix for this so I can run and test the application, I was wondering if there are any flags I can set when executing that will have the same effect - ie ./test -LD_LIBRARY_PATH="path-to-lib"

Looked around on the net and can't find anything =( help would be greatly appreciated.

回答1:

In bash, you can prepend executable with environment settings: LD_LIBRARY_PATH="path-to-lib" ./test