Execute a Command-line Script in Another Directory in Linux
I am running an application in one location on the file system, and I need to be able to invoke an application that is in a different directory on the file system. Due to personal preference, this other directory is not specified in the PATH variable. So I’m wondering how I can get Linux to know that it has to look for the second application in that other directory.
A simple way to approach this is to use the cd command in combination with the call to the second program. This will change the active directory to the second one and execute the command. This works for me because that call is being made in a different session than the one the first application is running in. Not sure if the terminology is right there. Please correct me if I’m wrong. Anyway, here’s the syntax:
cd /home/Bill/secondapp;./scriptname
