It's an equivalent of the command test
. (See info test
.) Generally you use it in scripts in conditional expressions like:
if [ -n "$1" ]; then
echo $1
fi
The closing bracket is required to enclose the conditional. (Well, it looks like its required just to look nicer in the code. Does anybody know any other practical reason for it?)
Sorry for this "answer", i tried to put this in a comment on your question, but the spacing and the formatting are limited.
ld-linux-x86-64.so.2 is a pretty core part of your OS. It actually runs every (64 bit) dynamic application. It's not a library as much as an app itself, a handler that is called when you run an app.
Basically, when you run a dynamic app, the kernel first runs ld-linux.so (or whatever name it is for your bitsize, distro, etc). ld-linux.so then peers into your app, sees the libraries that you need, sees any hard coded paths for the libraries (e.g. rpath's) checks LD_LIBRARY_PATH, and then goes looking for all those libraries, makes sure they match bitsizes, names, what have you. It then collects all of those, loads them, and runs your app. If it can't find the libs, it doesn't run your app.
ld-linux.so can not be affected by LD_LIBRARY_PATH because it is run by the kernel, and the kernel does not load libraries like ld-linux.so does, it just has the one it's configured to run. Again, not a library, so don't use library semantics (LD_LIBRARY_PATH) to change how it's called. It does have environment variables that affect it running - see man ld-linux.so
for details (besides LD_LIBRARY_PATH, LD_PRELOAD is very useful).
I'd be very interested to see what your issue is. No offense, but this seems to be an X-Y Problem. This again is a core OS piece. If it's broken, your OS would be broken. If you want to swap it out, you'd probably affect (read: break horribly) the rest of your system. Since you don't have root, I assume you're not the only one on this box, and you'd anger a few people. :)
What are you trying to do?
Best Answer
You could also do:
But this probably doesn't do what you want. It shows the libs that
executable
links to, but not all the libs it needs (a library can require another library).