How to safely prepend a directory to a PATH-like variable (in any POSIX-compliant shell): export LD_LIBRARY_PATH=/opt/whatever/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} Pull request sent to https://github.com/torch/distro/pull/228 .
I still find it kinda baffling glibc would have this behavior for a trailing colon (:). Like, I know it's probably legacy/comparability, but it feels like a security nightmare. ./ should be explicit, not implicit.