Getting the return code of `backquotes` commands or the output of system commads. 
Author Message
 Getting the return code of `backquotes` commands or the output of system commads.

Hello!

I have a CGI script where I lunch some external process, so evidently, I
do not want the output of this external process to mix in with my CGI
script's STDOUT.

So, I have been using `backquotes` to launch this external process,
unfortunately I haven't found a way to get the return code of the
launched process in this way.

Does anyone know how to get that return code?

Thanks!

Martin Proulx
Okiok Data



Tue, 11 Jan 2000 03:00:00 GMT  
 Getting the return code of `backquotes` commands or the output of system commads.

Quote:

> Hello!

> I have a CGI script where I lunch some external process, so evidently,
> I
> do not want the output of this external process to mix in with my CGI
> script's STDOUT.

> So, I have been using `backquotes` to launch this external process,
> unfortunately I haven't found a way to get the return code of the
> launched process in this way.

> Does anyone know how to get that return code?

> Thanks!

> Martin Proulx
> Okiok Data

  The variable '$?' should hold the value of the last `COMMAND`, pipe
close or system() command executed.

Simon



Tue, 11 Jan 2000 03:00:00 GMT  
 Getting the return code of `backquotes` commands or the output of system commads.

Quote:

> I have a CGI script where I lunch some external process, so evidently, I

First, CGI questions are best directed at groups with CGI in their
name (there's even one with both perl AND CGI in it's name).

Also, I consider it bad form to lunch external processes. It's ok, if
you're going dutch, but too much generosity can call attention to
one's own in-core usage.

Quote:
> do not want the output of this external process to mix in with my CGI
> script's STDOUT.

> So, I have been using `backquotes` to launch this external process,
> unfortunately I haven't found a way to get the return code of the
> launched process in this way.

Oh, now you're launching your lunch? See a doctor about that.

See also $?

                        -AJS



Tue, 11 Jan 2000 03:00:00 GMT  
 Getting the return code of `backquotes` commands or the output of system commads.

Quote:

> So, I have been using `backquotes` to launch this external process,
> unfortunately I haven't found a way to get the return code of the
> launched process in this way.

Check out the magical $? variable, documented in perlvar(1). Hope this
helps!

--
Tom Phoenix           http://www.teleport.com/~rootbeer/

Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



Tue, 11 Jan 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. getting bad return code when running UNIX command from perl

2. Newbie question on system vs backquotes

3. GGI system() and backquotes question

4. ActiveState: Commands Using BackQuotes Do not work (NT4-IIS4.0)

5. My CGI/Perl Code Gets Returned as Plain Text

6. Getting output of a slow command from `command`

7. Command executed using Telnet.pm on UnixWare 2.1.3 returns no output

8. Caputuring output and return code

9. Trouble getting system to return a value

10. Getting return value from .exe called from system

11. getting output from system

12. Getting System call return data

 

 
Powered by phpBB® Forum Software