Sponsored Content
Full Discussion: Reg trap signals
Top Forums Shell Programming and Scripting Reg trap signals Post 302855869 by Karthick N on Saturday 21st of September 2013 09:53:24 AM
Old 09-21-2013
Reg trap signals

Code:
let LIMIT=50  
function check {  
 if [[ LIMIT -eq 50 ]]; then  
   print LIMIT OK  
 else  
   print "LIMIT changed!"  
 fi  
}  
trap check DEBUG  
print $LIMIT  
LIMIT=$((LIMIT + 30))  
trap - DEBUG

Can anyone tell me how debugging is accomplished??

Last edited by jim mcnamara; 09-21-2013 at 10:59 AM..
 

10 More Discussions You Might Find Interesting

1. Programming

Signals In HP-UX

does the way of handling, interrupting signals in HP-UX same as that of solaris. If there is difference than what it is.?:confused: (1 Reply)
Discussion started by: kapilv
1 Replies

2. UNIX for Advanced & Expert Users

how to trap signals.

hi!!, i wanna trap all Signal 10, 11, 15 generated by any process running on my server irrespective of the user and wanna write to a log file. Any ideas? Do this script need to be a root process?? :cool: (1 Reply)
Discussion started by: jyotipg
1 Replies

3. Shell Programming and Scripting

Building a better mouse trap, or How many lines of code does it take to trap a mouse?

Hello all, I'm hoping to get a little insight from some of the wily veterans amongst you. I've written a script to check for new outgoing files to our vendors located on our ssl server. It seems to be working ok, but the final question here, will be one of logic, and/or a better way to... (4 Replies)
Discussion started by: mph
4 Replies

4. Shell Programming and Scripting

Cntl+z Trap is not detecting ??? Help required to add a trap detection ???

Hi folks, I have tried to add some trap detection in the below script....this script is used to monitor database activities...in a rather awkward way :rolleyes:.... The idea behind adding trap is that....this script creates lots of temporary files in the running folder to store the count... (1 Reply)
Discussion started by: frozensmilz
1 Replies

5. UNIX for Dummies Questions & Answers

Signals...

(posted this in the scripting forum as well, but figured it should go here) So, what's going on is this: For our program, we had to create our own shell, and if the user pressed ctrl-c just at the cmdline, then this signal would be ignored, but if there is a foreground process running, let's... (0 Replies)
Discussion started by: blind melon
0 Replies

6. Programming

Using Signals

How can use signals in a C program If i want a child program to signal it's parent program that it(child) program has completed the task that it was assigned.:confused: (2 Replies)
Discussion started by: kapilv
2 Replies

7. Shell Programming and Scripting

how trap the signals in shell scripting

Hi all, I have the c program that c program has to be in sleep mode. I want write a script the it should trap the signal from the c program. The signals are sighup,sigkill,sigterm,sigchld and then it has to go to sleep. If signal is sigchld it has to do to some function. My question is how to... (3 Replies)
Discussion started by: bhas85
3 Replies

8. Homework & Coursework Questions

VM trap may work differently than a pure install trap.

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: That is the last reply I received from my instructor, and I'm looking for some alternatives. When using... (2 Replies)
Discussion started by: newuser45
2 Replies

9. UNIX for Advanced & Expert Users

Help with Signals

Hi All, The problem statement is as below: Problem: A process (exe) is getting executed in background. The output of this process is getting logged in a file. After successfully running for some time the process gets terminated. In the log file following is present: ^M[7m Interrupt ^M[27m... (8 Replies)
Discussion started by: Praty.27
8 Replies

10. Shell Programming and Scripting

Help with trap and signals

I am having issues with trap not working inside a script. I am currently trying this on a Knoppix system V 5.1. What I would like to happen is when I press control c, a message gets echoed and the script is ended. For example: #! /bin/bash trap "echo CTRL c was pressed ; break" SIGINT... (11 Replies)
Discussion started by: Basherrr
11 Replies
Data::Entropy::Source(3pm)				User Contributed Perl Documentation				Data::Entropy::Source(3pm)

NAME
Data::Entropy::Source - encapsulated source of entropy SYNOPSIS
use Data::Entropy::Source; $source = Data::Entropy::Source->new($handle, "sysread"); $c = $source->get_octet; $str = $source->get_bits(17); $i = $source->get_int(12345); $i = $source->get_int(Math::BigInt->new("1000000000000")); $j = $source->get_prob(1, 2); DESCRIPTION
An object of this class encapsulates a source of entropy (randomness). Methods allow entropy to be dispensed in any quantity required, even fractional bits. An entropy source object should not normally be used directly. Rather, it should be used to support higher-level entropy-consuming algorithms, such as those in Data::Entropy::Algorithms. This type of object is constructed as a layer over a raw entropy source which does not supply methods to extract arbitrary amounts of entropy. The raw entropy source is expected to dispense only entire octets at a time. The /dev/random devices on some versions of Unix constitute such a source, for example. The raw entropy source is accessed via the "IO::Handle" interface. This interface may be supplied by classes other than "IO::Handle" itself, as is done for example by "Data::Entropy::RawSource::CryptCounter". If two entropy sources of this class are given exactly the same raw entropy data, for example by reading from the same file, and exactly the same sequence of "get_" method calls is made to them, then they will return exactly the same values from those calls. (Calls with numerical arguments that have the same numerical value but are of different types count as the same for this purpose.) This means that a run of an entropy-using algorithm can be made completely deterministic if desired. CONSTRUCTOR
Data::Entropy::Source->new(RAW_SOURCE, READ_STYLE) Constructs and returns an entropy source object based on the given raw source. RAW_SOURCE must be an I/O handle referring to a source of entropy that can be read one octet at a time. Specifically, it must support either the "getc" or "sysread" method described in IO::Handle. READ_STYLE must be a string, either "getc" or "sysread", indicating which method should be used to read from the raw source. No methods other than the one specified will ever be called on the raw source handle, so a full implementation of "IO::Handle" is not required. The "sysread" method should be used with /dev/random and its ilk, because buffering would be very wasteful of entropy and might consequently block other processes that require entropy. "getc" should be preferred when reading entropy from a regular file, and it is the more convenient interface to implement when a non-I/O object is being used for the handle. METHODS
$source->get_octet Returns an octet of entropy, as a string of length one. This provides direct access to the raw entropy source. $source->get_bits(NBITS) Returns NBITS bits of entropy, as a string of octets. If NBITS is not a multiple of eight then the last octet in the string has its most significant bits set to zero. $source->get_int(LIMIT) LIMIT must be a positive integer. Returns a uniformly-distributed random number between zero inclusive and LIMIT exclusive. LIMIT may be either a native integer, a "Math::BigInt" object, or an integer-valued "Math::BigRat" object; the returned number is of the same type. This method dispenses a non-integer number of bits of entropy. For example, if LIMIT is 10 then the result contains approximately 3.32 bits of entropy. The minimum non-zero amount of entropy that can be obtained is 1 bit, with LIMIT = 2. $source->get_prob(PROB0, PROB1) PROB0 and PROB1 must be non-negative integers, not both zero. They may each be either a native integer, a "Math::BigInt" object, or an integer-valued "Math::BigRat" objects; types may be mixed. Returns either 0 or 1, with relative probabilities PROB0 and PROB1. That is, the probability of returning 0 is PROB0/(PROB0+PROB1), and the probability of returning 1 is PROB1/(PROB0+PROB1). This method dispenses a fraction of a bit of entropy. The maximum amount of entropy that can be obtained is 1 bit, with PROB0 = PROB1. The more different the probabilities are the less entropy is obtained. For example, if PROB0 = 1 and PROB1 = 2 then the result contains approximately 0.918 bits of entropy. SEE ALSO
Data::Entropy, Data::Entropy::Algorithms, Data::Entropy::RawSource::CryptCounter, Data::Entropy::RawSource::Local, Data::Entropy::RawSource::RandomOrg, IO::Handle AUTHOR
Andrew Main (Zefram) <zefram@fysh.org> COPYRIGHT
Copyright (C) 2006, 2007, 2009, 2011 Andrew Main (Zefram) <zefram@fysh.org> LICENSE
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.3 2011-05-09 Data::Entropy::Source(3pm)
All times are GMT -4. The time now is 03:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy