I need to execute a shell script trough pipe.
I call popen("./something.sh, SZ_READ);
cat something.sh
dd if=/dev/...
I need to catch dd's exit status.
TIA
I need to catch dd's exit status.
TIA
--Nithyanand.
Siemens, Bangalore, India.
dd if=/dev/... || exit $?
inside the shell script or schould it be also runable without your program
than i would put it like this
dd if=/dev/... && DD_sucess=$?
if [ "$DD_ABBORT_IMMIDEATLY" == "YES" ] && [ $DD_success -ne 0 ];then
exit $DD_sucess
fi
and you will have to set the environment for your popen so that when
calling the script contains
the `DD_ABBORT_IMMIDEATLY' variable to `YES' in order to make the
script return immediatly after dd
or any safe place in your script with the exitstatus of the first/last
failed dd
cu
Christoph
ps.; wouldn't it be much safer to fork a subprocess and call dd there
via exec function ???
> I need to catch dd's exit status.
> TIA
x=$?Quote:> I need to execute a shell script trough pipe.
> I call popen("./something.sh, SZ_READ);
> cat something.sh
> dd if=/dev/...
...
exit $x
--
Communications Research Centre / RNS Tel (613) 998-2845
3701 Carling Ave., Fax (613) 998-9648
Ottawa, Ontario
K2H 8S2
Canada
This is what pclose() is for.
A stream opened by popen should be closed by pclose, which waits
for the associated process to terminate and returns the exit
status of the command.
If `dd' is not the last command in the script, save the exit status in
the script and exit with that status later as suggested in a different
message in this thread.
R'
>I need to catch dd's exit status.
>TIA
1. Help about popen() and exit status needed
Hi, all!
How can I get _command_ exit status of the following construction:
FILE* f1=popen(_command_,art);
Thanks,
Oleg.
---
===========================================================================
"InterWest" Oleg Y. Pronin
+7-0622-357-745
3. checking for exit status of called program?
4. linux for A500, anybody can't help me???
5. getting exit status of called program via system
6. Modem Recommendations for IJPPP and HylaFax?
7. Returning exit status to calling script
8. Trouble with librarys on porting project.
9. exit status of a shell script called from system()
10. Exit status in trapped exit function
11. should xargs exit on non-zero program exit status?
12. Exit status, $?, and term status
13. How do I exit a process trough a script?