Sponsored Content
Full Discussion: call more options on if
Top Forums UNIX for Advanced & Expert Users call more options on if Post 302687365 by Corona688 on Thursday 16th of August 2012 12:05:29 PM
Old 08-16-2012
Neither * nor -e nor or work that way. You can't cram more than one file into -e, it won't work. By 'or' you probably meant '||'.

I'd try a loop instead of a huge or-statement, and put the files found into the $1 $2 ... list, then check if the first exists.

As a useful side-effect, the files being looked for will end up individually in $1, $2, ...

Code:
PREFIX="$1"
for D in "%Y-%m-%d" "%Y_%m_%d" "%Y%m%d" "%y-%m-%d-%H-%" "%y%m%d%H%M"
do
        TODAY="`date +$D`"
        set -- ${PREFIX}${TODAY}*
        # && is a short-form if/then.  If "$1" exists, then break out of the loop.
        [ -e "$1" ] && break
done

if [ -e "$1" ]
then
        echo "Found $# files for today:  $*"
else
        echo "No files found for today"
fi


Last edited by Corona688; 08-16-2012 at 01:22 PM..
This User Gave Thanks to Corona688 For This Post:
 

7 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

cp options

Hello again, Is there an option for the cp command to overwrite existing files in the destination directory? Cheers Rob (3 Replies)
Discussion started by: milage
3 Replies

2. UNIX for Dummies Questions & Answers

options

I am just beginning to learn unix and I was wondering if there was a list of all the options somewhere on the net or hidden in the man pages? Also do options always have - and then a letter, or can it be - and a number as well? Thanks! (1 Reply)
Discussion started by: terms5
1 Replies

3. AIX

no options

Hi All, I have a situation here that's very fun... I have a system with AIX and iPlanet (sunOne) installed, when occurs an unknown event on the network the WebServer shows a thousand of CLOSE_WAIT connections and this number grows and grows until the webserver crashs. I read some documents... (2 Replies)
Discussion started by: nascimento.rp
2 Replies

4. UNIX for Advanced & Expert Users

how to differentiate system call from library call

Hi, Ho do I differentiate system call from library call? for example if I am using chmod , how do I find out if it is a system call or library call? Thanks Muru (2 Replies)
Discussion started by: muru
2 Replies

5. Infrastructure Monitoring

diffrence between method call and function call in perl

Hello, I have a problem with package and name space. require "/Mehran/DSGateEngineLib/general.pl"; use strict; sub System_Status_Main_Service_Status_Intrusion_Prevention { my %idpstatus; my @result; &General_ReadHash("/var/dsg/idp/settings",\%idpstatus); #print... (4 Replies)
Discussion started by: Zaxon
4 Replies

6. UNIX for Dummies Questions & Answers

Why do I need to call make if I call gcc ?

Why do I need to call make if I call gcc ? I thought gcc already compiles the sources. thanks (1 Reply)
Discussion started by: aneuryzma
1 Replies

7. Ubuntu

Kernel boot options removed by fault, no boot options

Hello Everyone, First of all, I highly appreciate all Linux forum members and whole Linux community. http://forums.linuxmint.com/images/smilies/icon_wink.gif. I wish you the best for all of you ! I will try to be short and concise: I am using Linux Mint 10 for 2 months on 2 ws, and all went... (3 Replies)
Discussion started by: cdt
3 Replies
EXIM_CONVERT4R4(8)					      System Manager's Manual						EXIM_CONVERT4R4(8)

NAME
exim_convert4r4 - Convert Exim configuration from v3 to v4 format SYNOPSIS
exim_convert4r4 DESCRIPTION
This script is provided to assist in updating Exim configuration files. It reads an Exim 3 configuration file on the standard input, and writes a modified file on the standard output. It also writes comments about what it has done to the standard error file. It assumes that the input is a valid Exim 3 configuration file. A typical call to the conversion script might be exim_convert4r4 < /etc/exim/exim.conf > /etc/exim4/exim4.conf.new The output file MUST be checked and tested before trying to use it on a live system. The conversion script is just an aid which does a lot of the "grunt work". It does not guarantee to produce an Exim 4 configuration that behaves exactly the same as the Exim 3 configuration it reads. Each option change in the new file is preceded by an identifying comment. In fact, the conversion script tends to make quite a mess of your configuration, and you should expect to go through it afterwards and tidy it up by hand. Unless you are running a very straightforward configuration, the automatic conversion is likely to generate a non-optimal configuration. You should not only check it thoroughly, but also run as many tests as you can, to ensure that it is working as you expect. In particular, you should test address routing, using -bt and -bv, and the policy controls, using -bh. If possible, you should also do some live tests (i.e. send and receive some messages) before putting Exim 4 into service. If you have a very complicated configuration, it is possible that exim_convert4r4 will break it in some situations, which is why thorough testing is strongly recommended. BUGS
This manual page needs a major re-work. If somebody knows better groff than us and has more experience in writing manual pages, any patches would be greatly appreciated. SEE ALSO
exim(8), the files in /usr/share/doc/exim4-base/, especially Exim4.upgrade.gz AUTHOR
This manual page was stitched together from Exim4.upgrade by Andreas Metzler <ametzler at downhill.at.eu.org>, for the Debian GNU/Linux system (but may be used by others). March 26, 2003 EXIM_CONVERT4R4(8)
All times are GMT -4. The time now is 02:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy