$ cat Test
#!/usr/bin/awk -f
BEGIN { FS=",";
if (ARGC != 3) {
print "You need 2 arguments on the command line"
exit 13
}
}
$ ./Test
You need 2 arguments on the command line
$ echo $?
13
$ ./Test 1
You need 2 arguments on the command line
$ echo $?
13
$ ./Test 1 2
$ echo $?
0
i downloaded a text file from metalab.unc.edu called sh.txt and in this reference manual it refers to shell scripting exit status .. at the end of one of the examples that author gave an exit status of 127..
to what does a 127 exit status refer too and what is its purpose in the code.
moxxx68 (1 Reply)
Hi,
I have a main program which have below lines
-
awk -f test.awk inputFileName
-
I wonder how to check status return from awk script.
content of awk script:
test.awk
---
if ( pass validation )
{
exit 1
}
else
{ (1 Reply)
Hi all,
I'm running a program which return 1 upon success.
But when encounters problem shell return 's '1' .
How to differentiate between them the shell return value and script return value.
Ex. function fn return '1' if executed successfully and '0' if failed. But when if shell encounters... (1 Reply)
I'm preparing for exam and one of exams is to write own test command...
I wonder if in unix is a command which just returns exit code you specify..
I know I can easily write a function like this:
exStatus() {
return $1
}
-> my question is rather theoretical
thank you! (9 Replies)
I have a shell script (#!/bin/sh) that interacts with Appworx and Banner Admin. In my script I want to check the exit status of awrun before continuing. awrun can run for 10 seconds or it can run for over a minute. So my question is, will it go through my if statement before awrun may even be... (2 Replies)
Hi everyone,
Looking at writing another awk program here to find a pattern on a text file. If patterns aren't found I want the awk program to exit and then bash to file a failure log on the local machine. Then later a management framework we have in place will read if that failure log file... (3 Replies)
Hi All,
I am trying to create a zip file with all the txt files(these are in large number) in the current directory. I am able to do this operation sucessfully.
After this i want to get the status of the tar command executed and do accordingly. When i am trying with the below code, the status... (3 Replies)
Dear team,
Need support to built awk script for below requirement
Input file
LOTC cluster state:
-------------------
Node safNode=SC_2_1 joined cluster |
Node safNode=SC_2_2 joined cluster |
Node safNode=PL_2_3 fail cluster |
AMF cluster state:
------------------... (16 Replies)
Discussion started by: shanul karim
16 Replies
LEARN ABOUT DEBIAN
lire::test::commandresult
CommandResult(3pm) LogReport's Lire Documentation CommandResult(3pm)NAME
Lire::Test::CommandResult - Object used to report the results of shell commands
SYNOPSIS
use Lire::Test::FunctionalTestCase;
my $result = $self->lire_run( "echo Test" );
print $result->status();
print $result->stdout();
print $result->stderr();
print scalar $result->sent_mail(), " emails were sent.
";
DESCRIPTION
Lire::Test::ComandResult objects are used to report the results of shell commands run through Lire::Test::FunctionalTestCase::lire_run().
command()
Returns the shell command that was run. This is the complete command line which was interpreated by the shell.
status()
Returns the command result status. (What is usually contained in $?).
stdout()
Returns what was output on stdout while executing the command.
stderr()
Returns what was output on stderr while executing the command.
sent_mail()
Returns in an array reference the message that were sent out during this command run. The element of this array are hash reference
containing two keys:
recipients
An array reference containing the recipients as passed on the command line to sendmail.
message
The email which was sent. This is the complete text of the email. This is what was passed to sendmail via STDIN.
SEE ALSO Lire::Test::FunctionaLTestCase(3pm)VERSION
$Id: CommandResult.pm,v 1.6 2006/07/23 13:16:31 vanbaal Exp $
AUTHOR
Francis J. Lacoste <flacoste@logreport.org>
COPYRIGHT
Copyright (C) 2003 Stichting LogReport Foundation LogReport@LogReport.org
This file is part of Lire.
Lire is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program (see COPYING); if not, check with
http://www.gnu.org/copyleft/gpl.html.
Lire 2.1.1 2006-07-23 CommandResult(3pm)