Sponsored Content
Top Forums Shell Programming and Scripting Multiple conditions inside my if statement Post 302693715 by Corona688 on Wednesday 29th of August 2012 03:06:35 PM
Old 08-29-2012
You can easily simplify that into one expression:
Code:
if [ "$L1" -eq 0 -a "$L2" -ge 1 -a "$L2" -le 3 ]

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

if statement with two conditions

Hi, I am trying to use && set up to match two conditions within ksh: if && then '''Do something if somehow, I keep getting error message telling me that ] is missing. What's wrong with my code? Thanks a lot for your help! (1 Reply)
Discussion started by: cin2000
1 Replies

2. UNIX for Dummies Questions & Answers

Two conditions in one if statement

I'm totally new with bash programming and I don't get it how to put two conditions in one if statement. My code looks like this: h=`date +%k` if && ]; then$h is 10 but I don't get into my if statement. What's wrong here? (5 Replies)
Discussion started by: borobudur
5 Replies

3. Shell Programming and Scripting

If statement with multiple conditions

I have a script that runs on multiple servers. What I want to do is have the script do the following: if $(hostname) is equal to server or server2 then TO_DIR=go else TO_DIR=stop fi I have tried: if if ] Server is hpux. any ideas? (1 Reply)
Discussion started by: cpolikowsky
1 Replies

4. Shell Programming and Scripting

multiple lines inside a case statement

echo "please enter ur choice.. 1. Make a file. 2. Display contents 3. Copy the file 4. Rename the file 5. Delete the file 6. Exit" read choice case $choice in 1 ) echo enter the file name read fname if then echo... (2 Replies)
Discussion started by: gotam
2 Replies

5. Shell Programming and Scripting

Multiple conditions in a CASE statement

is it possible to use multiple conditions in a CASE statement? And if so, what is the syntax? I'm trying to use one but can't seem to get it right. I want the statement to be CASE $vendor OR $alias condition 1) statements; condition 2) statements; etc. esac but I keep... (25 Replies)
Discussion started by: Straitsfan
25 Replies

6. Shell Programming and Scripting

Multiple Conditions Perl if Statement

Hello, I'm trying to put together a script that involves pulling data from a config file. I'm attempting to write an if statement to validate one of the pieces of data from the config file, but I think I'm fat fingering it somehow. $config{VALUE} is being pulled from a config file but can only... (4 Replies)
Discussion started by: Picch
4 Replies

7. UNIX for Dummies Questions & Answers

Multiple Find Conditions in IF Statement - UNIX

When I try the below if Condition with single condition its working fine. But when I try to Club both its working . But giving wrong results. In my case cond1 = -f ${filename1} = true cond2 = -f ${filename2} = true But Cond1 & Cond2 is resulting in False ??? Please advise ... (5 Replies)
Discussion started by: Shiny_Reddy
5 Replies

8. Shell Programming and Scripting

Multiple conditions inside if statement

I was trying to write multiple conditions inside the if statement but its not working. export VAR_NM=abc.txt export CURR_DT=20131011 export PREV_DT=20131012 if && then echo "Yes" else echo "NO" fi It should return Yes but returning NO always.Appreciate any help. (3 Replies)
Discussion started by: dr46014
3 Replies

9. Shell Programming and Scripting

How to Check Multiple conditions in IF statement?

I wish to check two conditions inside the if statement Condition 1: The two file contents should be identical // using cmp command for this. Condition 2: The two filenames should NOT be the same. This is what i did in vain. if ]; then where entry1 and entry2 are ls *.txt | while... (7 Replies)
Discussion started by: mohtashims
7 Replies
DI(3)							     Library Functions Manual							     DI(3)

NAME
DI - verify assertions in C and C++ code using gdb(1) SYNOPSIS
#include <DI.h> DI(exprn) DIG(exprn,guard) DIH(exprn,handler) DIP(exprn,param) DIGH(exprn,guard,handler) DIHP(exprn,handler,param) DIGHP(exprn,guard,handler,param) DS(exprn) DESCRIPTION
The DI(exprn) checks that the exprn is true in the same way as assert(3). It is however implemented by generating debugger commands from the source code and so only works if you run the command under a debugger after source the command file generated by nana(1). exprn - the expression to be checked. guard - the expression is normally only checked if the guard is true. handler - a macro which generates the code that handles the error condition. param - a parameter which can be passed off to the handler. This can be used for identifying the assertion failure in a space-efficent man- ner, e.g. by copying it into a register before aborting. See nana.info for details on configuring the behaviour on error detection, etc. You also need to include the nana library by using -lnana if you use the default setup. In addition to the DI, DIG, etc DI.h also provides DN, DNG, etc which are used to check that an expression is never true. SEE ALSO
nana-clg(1), nana(1), nana(3), I(3), L(3), DL(3), Q(3) and nana.info. The nana.info file is the primary documentation for this library. AUTHOR
Phil Maker <pjm@gnu.org> DI(3)
All times are GMT -4. The time now is 09:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy