Hi Folks,
I am trying to write a simple script which involves a potentially infinite loop repeating a number of tasks quickly.
I would like to enable the user to break out of this when he/she wishes (some key stroke) but not to break out of the script (i.e. which is what happens when a user... (4 Replies)
H,
I am running the following log.sh shell script.
$no_of_ps=7
while
do
echo "hello $no_of_ps"
ps_file=`tail -$no_of_ps /tmp/A380_RFS24/test.ls | head -1`
no_of_ps=`expr $no_of_ps - 1`
echo "package is: $ps_file" >> /tmp/A380_RFS24/log/A380_RFS24.log
ps_file1=`echo $ps_file| sed... (1 Reply)
Hi all, im doing this script in which i read from a logfile line by line, my problem is this:
The script was working fine until i added this statement to SSH into another machine to look for some data, it enters and retrieves the data just fine, but for some strange reason after it goes thru the... (1 Reply)
I am having trouble figuring this code
I want to grep a text from a file and if it match certain text it break out of the loop or it should continue searching for the text
Here is what I have written but it isn't working
while true
f=`grep 'END OF STATUS REPORT' filename`
do
if ... (9 Replies)
...when the lines use both a colon and commas to separate the parts you want read as information.
The first version of this script used cut and other non-Bash-builtins, frequently, which made it nice and zippy with little more than average processor load in GNOME Terminal but, predictably, slow... (2 Replies)
notimes=5
word=excellency
the word excellency contains 10 letters. 10 letters divided by 2 = 5. which means, 5 two-groups of letters are in the word excellency.
i need to perform a function on each group of letters. but the only thing i can think of is the following, which i just know... (5 Replies)
Hi I'm comparing same files names which are in different folders .
The first for loop for the files in DAY1 folder and
the second for loop for the files in DAY2 folder .
the first IF condition is for checking whether the file names are equal
the second If condtion is for checking the... (4 Replies)
Hello experts, I need help writing individual files from a data matrix, with each new file being written every time there is a blank line:
From this
cat file.txt
col1 col2 col3
6661 7771 8881
6661 7771 8881
6661 7771 8881
col1 col2 col3
3451 2221 1221... (6 Replies)
Oracle Linux : 6.4/bash shell
In the below I want to break out of the loop when it enters the 5th iteration.
#!/bin/bash
for i in 1 2 3 4 5 6
do
echo "$i"
if
echo "Oh Nooo... i = $i. I need to stop the iteration and jump out of the loop"
then break
fi
done
But, it only... (3 Replies)
in my python script i have loop like below:
for item in itemlist:
if <condition>:
<code>
else:
<code>
if <condition>:
if <condition>:
<code>
else:
for type in types:
if... (1 Reply)
Discussion started by: ctrld
1 Replies
LEARN ABOUT DEBIAN
io::async::protocol::linestream
IO::Async::Protocol::LineStream(3pm) User Contributed Perl Documentation IO::Async::Protocol::LineStream(3pm)NAME
"IO::Async::Protocol::LineStream" - stream-based protocols using lines of text
SYNOPSIS
Most likely this class will be subclassed to implement a particular network protocol.
package Net::Async::HelloWorld;
use strict;
use warnings;
use base qw( IO::Async::Protocol::LineStream );
sub on_read_line
{
my $self = shift;
my ( $line ) = @_;
if( $line =~ m/^HELLO (.*)/ ) {
my $name = $1;
$self->invoke_event( on_hello => $name );
}
}
sub send_hello
{
my $self = shift;
my ( $name ) = @_;
$self->write_line( "HELLO $name" );
}
This small example elides such details as error handling, which a real protocol implementation would be likely to contain.
DESCRIPTION EVENTS
The following events are invoked, either using subclass methods or CODE references in parameters:
on_read_line $line
Invoked when a new complete line of input is received.
PARAMETERS
The following named parameters may be passed to "new" or "configure":
on_read_line => CODE
CODE reference for the "on_read_line" event.
METHODS
$lineprotocol->write_line( $text )
Writes a line of text to the transport stream. The text will have the end-of-line marker appended to it; $text should not end with it.
AUTHOR
Paul Evans <leonerd@leonerd.org.uk>
perl v5.14.2 2012-10-24 IO::Async::Protocol::LineStream(3pm)