Sponsored Content
Top Forums Shell Programming and Scripting Test with non-zero status does not exit shell Post 302967116 by chebarbudo on Friday 19th of February 2016 01:12:33 PM
Old 02-19-2016
Much clearer.
The output of help set did not give me that much information.
Thanks for your help.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

exit status

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)
Discussion started by: moxxx68
1 Replies

2. Shell Programming and Scripting

checking exit status of a shell script

Hi, I have tried with the following code; if ;then echo "Failure." else echo "Success." fi to test the exit status of the test.ksh shell script. But whatever is the exit status of the test.ksh shell script Failure. is always printed. Please help. regards, Dipankar. (2 Replies)
Discussion started by: kdipankar
2 Replies

3. Programming

exit status running java classpath in unix shell

I have a java classpath running inside of a unix shell script. During my testing it will error with lines that show an example like this below. java.io.FileNotFoundException error at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.java:129), ... (2 Replies)
Discussion started by: mmcds
2 Replies

4. Shell Programming and Scripting

How to Create a shell script to test the telnet connection status

Hi friends, I'm newbie to shell script. I wanted to create a shell script which able to write a result for all the telnet connection status. For example, from this machine I want to test the telnet connection (total 100+ servers) with this machine. Any idea how to write this shell script?... (16 Replies)
Discussion started by: yhcheong
16 Replies

5. Shell Programming and Scripting

problem in exit status of the command in a shell script-FTP

Hi All, I have developed below script for FTP a file from unix machine to another machine. ftpToABC () { USER='xyz' PASSWD='abc' echo "open xx.yy.zbx.aaa user $USER $PASSWD binary echo "put $1 abc.txt" >> /home/tmp/ftp.$$ echo "quit" >> /home/tmp/ftp.$$ ftp -ivn <... (3 Replies)
Discussion started by: RSC1985
3 Replies

6. Shell Programming and Scripting

store last command exit status in variable in shell script

Hello All My req is to store the exit status of a command in shell variable I want to check whether the file has header or not The header will contain the string DATA_ACQ_CYC_CNTL_ID So I am running the command head -1 $i | grep DATA_ACQ_CYC_CNTL_ID Now I have to check if... (6 Replies)
Discussion started by: Pratik4891
6 Replies

7. Shell Programming and Scripting

Exit Status

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)
Discussion started by: smkremer
2 Replies

8. Shell Programming and Scripting

How to test for the ssh exit status in script?

Hello; I regularly run monitoring scripts over ssh to monitoring scripts But whenever a server is hung or in maintenance mode, my script hangs.. Are there anyways to trap exit status and be on my way ?? Looked at the ssh manpage and all I can see is a "-q" option for quiet mode .. Thank... (2 Replies)
Discussion started by: delphys
2 Replies

9. Shell Programming and Scripting

Test exit status of last cmd via ssh

see below for a housekeeping script which constructs an ssh cmd using some server/path/sudo info found in $HRINST. the script should hop to each server and if it finds a file to cleanup, moves it to the archive dir if there is nothing to move, it should report so and email the output ... (3 Replies)
Discussion started by: jack.bauer
3 Replies

10. Shell Programming and Scripting

Weird Exit Status of shell script

I have a script named check which will read the content of a file and check wether those files exist in the current directory. If so it will have the exit status of 0, otherwise it will have 1. check script: #!/bin/bash if ; then #Check there is enough command line parameters. exit 1... (2 Replies)
Discussion started by: Ray Sun
2 Replies
Moose::Cookbook::Basics::Recipe8(3)			User Contributed Perl Documentation		       Moose::Cookbook::Basics::Recipe8(3)

NAME
Moose::Cookbook::Basics::Recipe8 - Builder methods and lazy_build VERSION
version 2.0205 SYNOPSIS
package BinaryTree; use Moose; has 'node' => (is => 'rw', isa => 'Any'); has 'parent' => ( is => 'rw', isa => 'BinaryTree', predicate => 'has_parent', weak_ref => 1, ); has 'left' => ( is => 'rw', isa => 'BinaryTree', predicate => 'has_left', lazy => 1, builder => '_build_child_tree', ); has 'right' => ( is => 'rw', isa => 'BinaryTree', predicate => 'has_right', lazy => 1, builder => '_build_child_tree', ); before 'right', 'left' => sub { my ($self, $tree) = @_; $tree->parent($self) if defined $tree; }; sub _build_child_tree { my $self = shift; return BinaryTree->new( parent => $self ); } DESCRIPTION
If you've already read Moose::Cookbook::Basics::Recipe3, then this example should look very familiar. In fact, all we've done here is replace the attribute's "default" parameter with a "builder". In this particular case, the "default" and "builder" options act in exactly the same way. When the "left" or "right" attribute is read, Moose calls the builder method to initialize the attribute. Note that Moose calls the builder method on the object which has the attribute. Here's an example: my $tree = BinaryTree->new(); my $left = $tree->left(); When "$tree->left()" is called, Moose calls "$tree->_build_child_tree()" in order to populate the "left" attribute. If we had passed "left" to the original constructor, the builder would not be called. There are some differences between "default" and "builder". Notably, a builder is subclassable, and can be composed from a role. See Moose::Manual::Attributes for more details. The lazy_build shortcut The "lazy_build" attribute option can be used as sugar to specify a whole set of attribute options at once: has 'animal' => ( is => 'ro', isa => 'Animal', lazy_build => 1, ); This is a shorthand for: has 'animal' => ( is => 'ro', isa => 'Animal', required => 1, lazy => 1, builder => '_build_animal', predicate => 'has_animal', clearer => 'clear_animal', ); If your attribute starts with an underscore, Moose is smart and will do the right thing with the "predicate" and "clearer", making them both start with an underscore. The "builder" method always starts with an underscore. You can read more about "lazy_build" in Moose::Meta::Attribute CONCLUSION
The "builder" option is a more OO-friendly version of the "default" functionality. It also separates the default-generating code into a well-defined method. Sprinkling your attribute definitions with anonymous subroutines can be quite ugly and hard to follow. AUTHOR
Stevan Little <stevan@iinteractive.com> COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Infinity Interactive, Inc.. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.12.5 2011-09-06 Moose::Cookbook::Basics::Recipe8(3)
All times are GMT -4. The time now is 09:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy