troubleshooting Question

how to call a shell script from c++

Avatar of mannn
mannn asked on
Shell Scripting
2 Comments1 Solution626 ViewsLast Modified:
HI ,

I am calling a shell script from c++ using the

system(PATH);


My problem is path.

On my local copy the path is different from the one another box

so my question is

IS their any way can we give the path without starting from the /home ....

the script  should run unrelated  to the path...

Here is what i am trying to do

i have an application

named xyz

in that applications i have c ++,shell ,sql in following folders

Ccode,Scode,SQcode

i am calling the shell script from C++ code using the

system (/home/xyz/Scode/shell.sh)

Is their any way can we make the above one runs good if the application xyz kept in /home/abcd

i know i need to pass the whole path as

system(/home/abcd/xyz/Scode/shell.sh)

to run .

but can we do this work independent of the path the where  apllication xyz kept.

i need an

system(PATH)

PATH which works for both situations.

something like get the path before the xyz i.e where xyz is copied and keep the complete PATH in system

system(X/xyz/Scode/shell.sh)

where X should be dynamically generated path where the xyz is copied.
ASKER CERTIFIED SOLUTION
mikluhaf

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros