04-24-2002
Try this !
if [ $i = "+" -o $i = "-" -o $i = "/" -o $i = "%" ]; then
$x=$vr1
else
print "You have entered an invalid option."
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I want to do multiple comparisons on a series of numbers from an array:
I send the numbers in file1 through want to print out some info from file2 based on some conditions.
The syntax just isn't correct???
awk '
NR==FNR{
a=$0
next
... (2 Replies)
Discussion started by: dcfargo
2 Replies
2. Shell Programming and Scripting
Is it possible to setup two conditions for an if then statement in a pbash script?
For example, depending on the text value of a variable I parse out of an xml file, I want to assign it a numerical values.
Example:
if ; then
VAR="25"
fi
if ; then
VAR="25"
fi
Can these two... (3 Replies)
Discussion started by: audiophile
3 Replies
3. Shell Programming and Scripting
Hi All,
I am new to shell scripting.
Can any one say what is wrong in this if statement, that uses multiple conditions
if
then
***************
else
if ( -z $pcs && "$night_time_calc" > "$night_time" )
then
********************************
... (4 Replies)
Discussion started by: ssenthilkumar
4 Replies
4. Shell Programming and Scripting
Please help me. I have been doing this for several hours.
Here is the code
if then
echo a b c d >> file.txt
echo 1111 >> file.txt
fi
The reason I want the two echo is because I want these statements printed on multiple lines. I keep getting error .
First it tells me... (2 Replies)
Discussion started by: asemota
2 Replies
5. Shell Programming and Scripting
Hi,
Hav automated a process, and it is working fine.
for first process alone
status = ` ps -ef |grep a `
if
then
echo " Success" > temp/logfile
else
echo " Failure" > temp/logfile
fi
Now I hav to write script to automated some 2 process and then send mail using cron..
... (5 Replies)
Discussion started by: NehaKrish
5 Replies
6. Shell Programming and Scripting
how can we execute multiple statements in
else condition
i have
if
then
statement
else
statements
fi
in else condition i have multiple statements
but it executing only one statement
is there any way to execute multiple statements (4 Replies)
Discussion started by: nani1984
4 Replies
7. Shell Programming and Scripting
Hi All,
I need to check for 3 conditions and if all the 3 are not satified need to say that services are not running....
is the below code correct.
#********** Check to see if Service 1 is still running**************
if
then
echo "$datetimestamp: Service1 is not running" >>... (4 Replies)
Discussion started by: ch33ry
4 Replies
8. Shell Programming and Scripting
I'm working on a script for class as a final project. We have to ask for values (city, state, zip) five times, but the state can only be MI, IN, IL, or OH. I'm trying to do this with a while loop inside of a while loop, but I have no idea how to do it properly.
Here's what I have so far:
... (3 Replies)
Discussion started by: nickzourdos
3 Replies
9. UNIX for Dummies Questions & Answers
exmaple:
file1 and file2 has 1 bit
if
then
exit
else
send out email
fi
if
then
exit
else
send out email
fi
it exits the 1st if. did not continue with my 2nd if. thanks in advanced.
Please use CODE tags are suggested on every page when you post an item in... (7 Replies)
Discussion started by: lawsongeek
7 Replies
10. Shell Programming and Scripting
Hello,
I am new to scripting and I am trying to write a simple script that creates users and adds their passwords from two files; one a user list file and another a password list file.
For example, I have two files already.
$ cat file1
andy
stephane
aby
paul
$ cat file2
123
234... (4 Replies)
Discussion started by: FemoTheDon
4 Replies
LEARN ABOUT DEBIAN
log::contextual::simplelogger
Log::Contextual::SimpleLogger(3pm) User Contributed Perl Documentation Log::Contextual::SimpleLogger(3pm)
NAME
Log::Contextual::SimpleLogger - Super simple logger made for playing with Log::Contextual
SYNOPSIS
use Log::Contextual::SimpleLogger;
use Log::Contextual qw( :log ),
-logger => Log::Contextual::SimpleLogger->new({ levels => [qw( debug )]});
log_info { 'program started' }; # no-op because info is not in levels
sub foo {
log_debug { 'entered foo' };
...
}
DESCRIPTION
This module is a simple logger made mostly for demonstration and initial experimentation with Log::Contextual. We recommend you use a real
logger instead. For something more serious but not overly complicated, take a look at Log::Dispatchouli.
METHODS
new
Arguments: "Dict[
levels => Optional[ArrayRef[Str]],
levels_upto => Level,
coderef => Optional[CodeRef], ] $conf"
my $l = Log::Contextual::SimpleLogger->new({
levels => [qw( info warn )],
coderef => sub { print @_ }, # the default prints to STDERR
});
or
my $l = Log::Contextual::SimpleLogger->new({
levels_upto => 'debug',
coderef => sub { print @_ }, # the default prints to STDERR
});
Creates a new SimpleLogger object with the passed levels enabled and optionally a "CodeRef" may be passed to modify how the logs are
output/stored.
"levels_upto" enables all the levels upto and including the level passed.
Levels may contain:
trace
debug
info
warn
error
fatal
$level
Arguments: @anything
All of the following six methods work the same. The basic pattern is:
sub $level {
my $self = shift;
print STDERR "[$level] " . join qq{
}, @_;
if $self->is_$level;
}
trace
$l->trace( 'entered method foo with args ' join q{,}, @args );
debug
$l->debug( 'entered method foo' );
info
$l->info( 'started process foo' );
warn
$l->warn( 'possible misconfiguration at line 10' );
error
$l->error( 'non-numeric user input!' );
fatal
$l->fatal( '1 is never equal to 0!' );
is_$level
All of the following six functions just return true if their respective level is enabled.
is_trace
say 'tracing' if $l->is_trace;
is_debug
say 'debuging' if $l->is_debug;
is_info
say q{info'ing} if $l->is_info;
is_warn
say 'warning' if $l->is_warn;
is_error
say 'erroring' if $l->is_error;
is_fatal
say q{fatal'ing} if $l->is_fatal;
AUTHOR
See "AUTHOR" in Log::Contextual
COPYRIGHT
See "COPYRIGHT" in Log::Contextual
LICENSE
See "LICENSE" in Log::Contextual
perl v5.10.1 2010-07-31 Log::Contextual::SimpleLogger(3pm)