home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!newsflash.concordia.ca!hobbit.ireq.hydro.qc.ca!guy
- From: guy@mais.hydro.qc.ca (Guy Harel)
- Subject: How to get to $? of /bin/sh
- Message-ID: <guy.726876346@tdsb-s>
- Sender: news@ireq.hydro.qc.ca (Netnews Admin)
- Organization: Hydro-Quebec (DSB)
- Date: Tue, 12 Jan 1993 22:05:46 GMT
- Lines: 21
-
- Hi,
-
- I`m new to PERL, and would like to know how to get the value of
- the status var ($?) of a command submitted to the SH:
-
- For example the following gets rid of the error message, as I want:
-
- $status=`cp >/dev/null 2>&1`;
-
- But if I try to print $? on the second line, I get '0' since the PERL
- line executed without problems.
-
- Can I get to $? without resorting to:
-
- $status=`cp 2>/dev/null; echo $? `;
-
-
- Thanks
-
- --
- --
-