473,378 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Capture the return status from a shell script using system call

Hi,

I am calling a unix script from my c program, but i need to capture the return value of the script. The system() function would return whether the script was successfully executed or not. But the return value of the script is needed within the C program.

Please help me out here.

Thanks and Regards,
Nav
Mar 4 '11 #1
3 3065
weaknessforcats
9,208 Expert Mod 8TB
You might try creating a file in your C program and then use that file as the return from your program to the script.
Mar 7 '11 #2
I have thought about that, but I can consider it as the last resort. Is there any other way of finding out the return status of the script from a c program? Any other function?
Mar 9 '11 #3
weaknessforcats
9,208 Expert Mod 8TB
Not that I know of. Your C program must leave a mark somewhere the script can find it. The return from main() is used (or maybe not used( by the OS and therefore may not be passed on to your script.
Mar 12 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Juggler | last post by:
Hi, I have a shell script which takes three arguments, how can I call this script from within a C++ program. I am new to C++ programming and not sure how to accomplish this. I tried using...
3
by: gmtonyhoyt | last post by:
Okay, this one's a tough one for me to explain so this might take a few e-mails to get the idea across. Here's what I got though. I have this application running on a Sun/Solaris machine,...
0
by: Aashif | last post by:
I want to call Unix Shell script which is available in other Server (Unix server) from windows application using C#. Currently the shell script runs the C program but the GUI is not good, So I want...
3
by: soniamadtha | last post by:
Hello everyone i have the following script (extract.pl) #!/usr/bin/perl # Purpose : This Program is used to extract only the stocklist from the input string #use warnings; scalar @ARGV...
1
by: Calder Coalson | last post by:
I was searching for ways to get the return value from os.system() calls, when I came across this from 6 years ago. I tried what was suggested in this thread, but output =...
1
by: houh | last post by:
I have a java app that generates openoffice docs. When I run the java app in a shell script, as: export JAVA_HOME=/opt/corp/projects/metrics/Java/jdk1.5.0_07/bin/java export...
0
by: shaheda begum | last post by:
Hi everyone, Can anyone guide me how to link archive file(libxyssl.a) to my shell script( .sh file) in Perl using swig interface. Thank you in advance.
3
by: BibhuAshish | last post by:
Hi, I have a button. I want to run a shell script when i click that button. My HTML code is given below: <html> <head> </head> <body> <input type = "button" value = "run script" onclick =...
3
by: xtremebass | last post by:
Hi , I am want to run the shell script to run every 10 minutes of interval ,so that i have used crontab command for scheduling the shell script .. it cant works . i have checked wall command in...
6
by: tvnaidu | last post by:
I am trying to create a directory "/log" in linux in below file, it is not creating, I commented windows call and added linux call ro create /log dir. #define DEFAULT_LOG_DIR "/log" void...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.