I'm trying to compile a library and his dependencies (lots of dependencies), but the system that I'm using didn't have the usual directory structure. I'm searching for a method to "redirect" all the scripts callings to, for example, /bin/sh to /foo/bar/sh.

Is something like this possible?


I forgot to tell that / is read-only, so i can't make a /bin directory containing symbolic links pointing to the actual bin directory


You can use symbolic links.

ln -s /foo/bar/sh /bin/sh

First, you'll have to remove the original /bin/sh. But make sure you don't use the /bin/sh at the moment you launch the rm (or mv), otherwise you may get yourself locked. The best change your shell to /foo/bar/sh first and try to login while you still have original shell running so you can fix possible issues.

  • I forgot to tell that i already tried this, but / is read-only, so i can't... – Michele Oct 10 '17 at 8:25

Just use the $PATH variable.

export PATH=/foo/bar:$PATH <command>

In this way you will load binaries before from /foo/bar than /bin.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.