- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: How to know the Exit status of a executable in...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-20-2008 05:01 AM
тАО02-20-2008 05:01 AM
Can any one please help me to solve the below problem.
I have a perl script. In the Perl script i am executing a "a.out" file using the system("./a.out").
But, I want to check whether the a.out terminated normally without causing any "Bus Error" or "Segmentation Fault".
CAn i do this using "$?". If yes what will be the exit status for normal execution. And does this exit status differ for different flavours of UNIX like Linux and SunOs.
thanks in advance
regards
Vikram
Solved! Go to Solution.
- Tags:
- exit status
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-20-2008 06:08 AM
тАО02-20-2008 06:08 AM
SolutionTo obtain the exit value you need to examine the high eight bits of the value returned:
Hence:
# perl -le '$rc=system("/usr/bin/cp");print "exit status = ",$rc>>8'
1
...looks just like you did:
# /usr/bin/cp; echo $?
1
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-20-2008 08:30 AM
тАО02-20-2008 08:30 AM
Re: How to know the Exit status of a executable in HP Unix through PERL
perldoc -f system
or
perldoc perlvar
if you look for $?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-20-2008 08:41 AM
тАО02-20-2008 08:41 AM
Re: How to know the Exit status of a executable in HP Unix through PERL
perldoc -f system
or
perldoc perlvar
if you look for $?
Except for SIGKILL and SIGSTOP you can implement a signal handler by assigning the special Perl hash %SIG a code ref to the appropriate key which is the respective signal name without the prefix SIG.
Details to %SIG may also be found in perldoc perlvar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-20-2008 08:43 AM
тАО02-20-2008 08:43 AM
Re: How to know the Exit status of a executable in HP Unix through PERL
This only happens because there are minutes between clicking submit and waiting for the server confirmational response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-20-2008 10:51 AM
тАО02-20-2008 10:51 AM
Re: How to know the Exit status of a executable in HP Unix through PERL
> between clicking submit and waiting for the
> server confirmational response.
So, don't wait for that. Wait a few seconds,
then re-view the topic. (I open a new window
for the Reply, so it's easy to reload the
original thread's window after Submitting the
reply.)
And when Submit from Preview fails for no
good reason, just back up to the pre-Preview
page, and try Submit from there.
And when it gets all confused by switching
between forums11.itrc.hp.com and
forums12.itrc.hp.com, try editing the URL to
say forums.itrc.hp.com.
And so on ...
The Forum software appears to be garbage, but
figuring out how to work around its many
problems can be viewed as an entertaining
game (if you're easily entertained).