Sponsored Content
Full Discussion: Else Loop Exiting Early
Top Forums Shell Programming and Scripting Else Loop Exiting Early Post 302177246 by joeyg on Thursday 20th of March 2008 12:07:42 PM
Old 03-20-2008
Question A couple of things I noticed

Code:
      check_ul_process

   elsif [ $UL_PROCESS -eq 0 -a $UL_FILE_TYPE = TEMP ]

(1) Your first if condition calls itself - you are nesting a restart of the program.
(2) I do not think this 'elsif' can execute since the simpler first part [$UL_PROCESS -eq 0] would always be caught above.
(3) I cannot say for sure, but your "if then elsif else fi" does not quite feel right. Perhaps it requires "elif then" to make computer logic correct.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash: Exiting while true loop when terminal is not the focus window

I am running an Ubuntu Gutsy laptop with Advanced Compiz fusion options enabled. I am using xdotool to simulate keyboard input in order to rotate through multiple desktops. I am looking for a way to kill a while true loop when the Enter key (or Control+C if it is easier) is pushed when the... (2 Replies)
Discussion started by: acclaypool
2 Replies

2. Shell Programming and Scripting

exiting from a loop

I wonder if someone could help me here. I am trying to find a way of exiting from a loop but not exiting me from the script for example #!/bin/ksh # ************* FUNCTIONS ****************** function1() { #ping test ping $1 2 > /dev/null if ; then ... (13 Replies)
Discussion started by: hcclnoodles
13 Replies

3. UNIX Benchmarks

Early PowerMac G5

Hardware Overview: Model Name: Power Mac G5 Model Identifier: PowerMac7,2 Processor Name: PowerPC 970 (2.2) Processor Speed: 1.8 GHz Number Of CPUs: 2 L2 Cache (per CPU): 512 KB Memory: 1.5 GB Bus Speed: 900 MHz Boot ROM Version:... (0 Replies)
Discussion started by: tnorth
0 Replies

4. UNIX for Advanced & Expert Users

"while read ..." loop exiting after reading only one record

Greeting, The following script completes after reading only one record from the input file that contains many records. I commented out the "ssh" and get what I expect, an echo of all the records in the input.txt file. Is ssh killing the file handle? On the box "uname -a" gives "SunOS... (2 Replies)
Discussion started by: twk
2 Replies

5. Shell Programming and Scripting

Problem in exiting a loop

Hi my code looks like: if test $STEP -le 10 then . . ls -1d AM*-OUT|while read MYDIR do cd $MYDIR ls |tail -n1| while read MYFILE do . . if test -s $MYFILE then sqlldr .... rc=$? if test $rc -ne 0 (3 Replies)
Discussion started by: anijan
3 Replies

6. Shell Programming and Scripting

Loop Forever Script Strangely Exiting

Hi, I have a really simple script which I want to run forever, inside the loop it runs a C application which if it exits should restart. #!/bin/sh while true do ./SCF scf.conf >> scf.log sleep 2 done For some reason the SCF C application coredumps and the script is exiting.... (3 Replies)
Discussion started by: marvinwright
3 Replies

7. Shell Programming and Scripting

Problem exiting a WHILE loop in ksh

Hi I am having a problem exiting a WHILE loop. I am on a Sun server using ksh. I am running a Veritas Cluster Software (High Availablity) command to obtain a group status and grepping the command output for status "G" which means that the filesystem is frozen and therefore not available to... (3 Replies)
Discussion started by: bigbuk
3 Replies

8. Shell Programming and Scripting

While Loop Exiting

We are trying to design a flow so that an ETL job shouldn't start until the previous job completes. The script we have written is while ; do sleep 2; done The loop however exits even when the process is actually running. Why could this be happening? (12 Replies)
Discussion started by: jerome_rajan
12 Replies

9. Shell Programming and Scripting

For loop exiting

Hi , I am processing some files using below shell script the problem for loop exit after processing some files even though it exist.After modifying file.txt and rerunning the script and its running .Any Advise for i in `cat /xx/file.txt |tr -s "," '\n' ` ; do echo $i... (3 Replies)
Discussion started by: mohan705
3 Replies
TAP::Parser::SourceHandler(3pm) 			 Perl Programmers Reference Guide			   TAP::Parser::SourceHandler(3pm)

NAME
TAP::Parser::SourceHandler - Base class for different TAP source handlers VERSION
Version 3.23 SYNOPSIS
# abstract class - don't use directly! # see TAP::Parser::IteratorFactory for general usage # must be sub-classed for use package MySourceHandler; use base qw( TAP::Parser::SourceHandler ); sub can_handle { return $confidence_level } sub make_iterator { return $iterator } # see example below for more details DESCRIPTION
This is an abstract base class for TAP::Parser::Source handlers / handlers. A "TAP::Parser::SourceHandler" does whatever is necessary to produce & capture a stream of TAP from the raw source, and package it up in a TAP::Parser::Iterator for the parser to consume. "SourceHandlers" must implement the source detection & handling interface used by TAP::Parser::IteratorFactory. At 2 methods, the interface is pretty simple: "can_handle" and "make_source". Unless you're writing a new TAP::Parser::SourceHandler, a plugin, or subclassing TAP::Parser, you probably won't need to use this module directly. METHODS
Class Methods "can_handle" Abstract method. my $vote = $class->can_handle( $source ); $source is a TAP::Parser::Source. Returns a number between 0 & 1 reflecting how confidently the raw source can be handled. For example, 0 means the source cannot handle it, 0.5 means it may be able to, and 1 means it definitely can. See "detect_source" in TAP::Parser::IteratorFactory for details on how this is used. "make_iterator" Abstract method. my $iterator = $class->make_iterator( $source ); $source is a TAP::Parser::Source. Returns a new TAP::Parser::Iterator object for use by the TAP::Parser. "croak"s on error. SUBCLASSING
Please see "SUBCLASSING" in TAP::Parser for a subclassing overview, and any of the subclasses that ship with this module as an example. What follows is a quick overview. Start by familiarizing yourself with TAP::Parser::Source and TAP::Parser::IteratorFactory. TAP::Parser::SourceHandler::RawTAP is the easiest sub-class to use an an example. It's important to point out that if you want your subclass to be automatically used by TAP::Parser you'll have to and make sure it gets loaded somehow. If you're using prove you can write an App::Prove plugin. If you're using TAP::Parser or TAP::Harness directly (e.g. through a custom script, ExtUtils::MakeMaker, or Module::Build) you can use the "config" option which will cause "load_sources" in TAP::Parser::IteratorFactory to load your subclass). Don't forget to register your class with "register_handler" in TAP::Parser::IteratorFactory. Example package MySourceHandler; use strict; use vars '@ISA'; # compat with older perls use MySourceHandler; # see TAP::Parser::SourceHandler use TAP::Parser::IteratorFactory; @ISA = qw( TAP::Parser::SourceHandler ); TAP::Parser::IteratorFactory->register_handler( __PACKAGE__ ); sub can_handle { my ( $class, $src ) = @_; my $meta = $src->meta; my $config = $src->config_for( $class ); if ($config->{accept_all}) { return 1.0; } elsif (my $file = $meta->{file}) { return 0.0 unless $file->{exists}; return 1.0 if $file->{lc_ext} eq '.tap'; return 0.9 if $file->{shebang} && $file->{shebang} =~ /^#!.+tap/; return 0.5 if $file->{text}; return 0.1 if $file->{binary}; } elsif ($meta->{scalar}) { return 0.8 if $$raw_source_ref =~ /d..d/; return 0.6 if $meta->{has_newlines}; } elsif ($meta->{array}) { return 0.8 if $meta->{size} < 5; return 0.6 if $raw_source_ref->[0] =~ /foo/; return 0.5; } elsif ($meta->{hash}) { return 0.6 if $raw_source_ref->{foo}; return 0.2; } return 0; } sub make_iterator { my ($class, $source) = @_; # this is where you manipulate the source and # capture the stream of TAP in an iterator # either pick a TAP::Parser::Iterator::* or write your own... my $iterator = TAP::Parser::Iterator::Array->new([ 'foo', 'bar' ]); return $iterator; } 1; AUTHORS
TAPx Developers. Source detection stuff added by Steve Purkis SEE ALSO
TAP::Object, TAP::Parser, TAP::Parser::Source, TAP::Parser::Iterator, TAP::Parser::IteratorFactory, TAP::Parser::SourceHandler::Executable, TAP::Parser::SourceHandler::Perl, TAP::Parser::SourceHandler::File, TAP::Parser::SourceHandler::Handle, TAP::Parser::SourceHandler::RawTAP perl v5.16.2 2012-10-25 TAP::Parser::SourceHandler(3pm)
All times are GMT -4. The time now is 12:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy