Advertisement

Running an exe from a different folder

Started by September 09, 2004 08:26 AM
2 comments, last by ontheheap 20 years ago
Am trying to run a exe on my unix machine from a different folder. For instance, i have a perl file in a folder /home/asif/runprj.pl which runs a exe in a different folder /home/projects/cobsat/a.out and my perl file is something like this #!/usr/bin/perl system("/home/projects/cobsat/a.out"); now ...is there anyway I can run the exe by actually getting into the cobsat directory and simply execute ./a.out instead of runnin it with absolute path.
cd absolute path to file?
Advertisement
Isn't it the same? I mean, you are executing it anyway by giving it the full path.


You can use the cd command to get into the map and then run it.

#!/usr/bin/perl
cd("/home/projects/cobsat");
system("a.out");


I think that will work....
You could also make a symbolic link and then run that. When you are done, remove the symbolic link. I don't see what's wrong with using the absolute path though. Since in order to find the app you need to know it's absolute path anyways...

- Stephen

This topic is closed to new replies.

Advertisement