LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to execute binaries located in a different directory (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-execute-binaries-located-in-a-different-directory-861461/)

pghosh06 02-08-2011 12:52 PM

how to execute binaries located in a different directory
 
Hello , i am a newbie in writing unix scripts:

I have a file with a list of arguments like:
./a arg1 arg2 arg3
./b arg1 arg2 arg3
.
.
.
./n arg1 arg2 arg3

but these binaries (a,b,..etc) are in a different sub directory from where the above file is located. How do I write a script that will pick up each line from the file and execute it.

paulsm4 02-08-2011 02:21 PM

Something like this (substitute "my/xyz/dir" for your actual path):
Code:

EXE_DIR=/my/exe/dir
DATA_DIR=/my/data/dir

cd $DATA_DIR
$EXE_DIR/a arg1 arg2 arg3
$EXE_DIR/b arg1 arg2 arg3
.
.
.
$EXE_DIR/n arg1 arg2 arg3

There are many more - and much more elaborate - things you can do. But I hope this gets you started in the right direction.

pghosh06 02-08-2011 02:46 PM

Thanks so much... that was helpful :)


All times are GMT -5. The time now is 11:51 PM.