Sponsored Content
Top Forums Shell Programming and Scripting How to giv two conditions in IF statement..?? Post 302189209 by RRVARMA on Friday 25th of April 2008 08:53:00 AM
Old 04-25-2008
Error How to giv two conditions in IF statement..??

Actually i need to satisfy both the condition..
lik i'm lookin for two different files.. and if BOTH the files r not present then it should run the followin script.. For example

inputfile1=data/in/inputfile1.txt
inputfile2=data/in/inputfile2.txt

if [ ! -f ${inputfile1} && ! -f ${inputfile2} ]
then

echo " "
echo "ERROR: Files not found."
echo " "
exit 1

fi


echo " "
echo "RUN SUCCESSFUL: Both Files found. "
echo " "

exit 1

Here even if the second file is not present its showing RUN SUCCESSFUL.. Please Help...
 

10 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

Multipe conditions in if statement

I have a script that runs every 15 minutes in cron that builds a web page. It runs at 15, 28, 45 and 58 minutes past the hour. (pretty much evry 15 mins). Every 2 hours from 6:28 to 18:28 it sends out emails if it finds errors. I do not want it sending email every single time it runs, every 15... (5 Replies)
Discussion started by: spacemancw
5 Replies

5. 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

6. Shell Programming and Scripting

How to Evaluate two conditions in single if statement

I am trying to test two conditions in a single if and getting syntax error on -a and && if ] ; then echo "variable a equals to variable b" else echo "variable a not equal to variable b" fi in second attempt I used -a instead of &&, referring to other website, but not sure that... (1 Reply)
Discussion started by: praxis1
1 Replies

7. Shell Programming and Scripting

Multiple conditions inside my if statement

Hello, I am using shell scripting and I am recieving odd results from my if statement if I want it to enter the loop only if L1 is equal to zero and one of the other criteria are filled, however it is entering at other times as well. What can i do to fix this? i tried seperating it... (6 Replies)
Discussion started by: ryddner
6 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. UNIX for Dummies Questions & Answers

If statement with two boolean conditions

#!/bin/bash if && then echo "True" else echo "False" fi Hi everyone, I am new to UNIX, here I have a if statement elevating two boolean conditions. I thought the output should be True because there are + in the statement. But it turns out to be False. Can anyone... (3 Replies)
Discussion started by: mryuyu1111
3 Replies

10. 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
BIB2BIB(1)						      General Commands Manual							BIB2BIB(1)

NAME
BibX2bib - Filter BibTeX data bases SYNOPSIS
bib2bib [options] <filename> ... DESCRIPTION
bib2bib is a filter tool that reads one or several bibliography files, filters the entries with respect to a given criterion, and outputs the list of selected keys together with a new bibliography file containing only the selected entries. If no input file is given then input is taken from the standard input. Additionally, bib2bib may output a file containing all the keys of entries that satisfy the condition. This second file is suitable for input as option -citefile to bibtex2html OPTIONS
-ob filename specify the filename where the selected entries are output. If not given, it defaults to standard output. -oc filename specify the filename where the list of selected keys is output. If not given, this file is not created. -c condition specify a condition for selecting the entries. The output will retain only the entries that satisfy this condition. If several such condition are given, then only the entries that satisfy all the conditions are selected. The syntax of conditions is described in the complete documentation, notice that it is better to escape shell expansions in that conditions, in other words, you should write conditions between quotes. -expand expand all abbreviations in the output file. Notice that there is no way to ask for expansion of cross-references, since the meaning of such an expansion is unclear: it's better to let bibtex (via bibtex2html) handle the cross-references himself, depending on the style considered. -s field sorts the entries of the bibliography with respect to the given field, which may be $key or $type to refer to the key or to the entry type, as for filter conditions. This options may be used several times to specifiy a lexicographic order, such as by year, then by keys. When the field is $date then entries are sorted chronologically. When sorting, the resulting bibliography will always contain the comments first, then the preambles, then the abbreviations, and finally the regular entries. Be warned that such a sort may put cross-references before entries that refer to them, so be cautious. -r reverses the sort -q , --quiet be quiet. -w , --warn-error stop at the first warning. USAGE WITH BIBTEX2HTML Notice that the two output files are suitable for use with bibtex2html. A typical use would be bib2bib -oc citefile -ob bibfile.bib -c condition file1.bib file2.bib ... bibtex2html -citefile citefile bibfile.bib which will produce exactly the HTML file for the selected references. Notice finally that bibtex2html will expand the strings (by default, unless you specify the -noexpand option) but not the cross-references. AUTHOR
Bib2bib has been written by Jean-Christophe Filliatre and Claude Marche. This manpage has been compiled by Ralf Treinen from the original bib2bib documentation. SEE ALSO
bibtex2html(1),bibtex(1),hevea(1) http://www.lri.fr/~filliatr/bibtex2html/ For complete documentation, please check the bibtex2html manual. On a Debian system the manual can be found at /usr/share/doc/bibtex2html both in the formats postscript and HTML, or via the Debian help system. BIB2BIB(1)
All times are GMT -4. The time now is 04:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy