[prev in list] [next in list] [prev in thread] [next in thread] 

List:       suse-linux-e
Subject:    Re: [SLE] Testing using Bash for an unknown extension
From:       Jerry Feldman <gaf () blu ! org>
Date:       2003-11-30 15:45:49
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On Sun, 30 Nov 2003 15:23:28 +0000
Vic Ayres <vic@ayresonline.co.uk> wrote:

> Sean Rima wrote:
> > I am trying to test to see if a file exsides but the extension
> > changes all the time, ie
> > 
> > ab251455.001
> > ab251455.002
> > 
> > if I do a :
> > if [ -e /var/max/spool/inbound/ab251455.* ] ; then
> >     run_command
> > fi
> > 
> > the run_command never runs
> > 
> 
> That's strange. I tried with
> #!/bin/bash
> if [ -e ab123.* ] ; then
>          echo "It exists"
> fi
> and it works perfectly. Is run_command in the path?
You might be a bit better off using the for command. 
#!/bin/bash
if [ -e /var/max/spool/inbound/ab251455.* ] ; then
	LIST=$(ls /var/max/spool/inbound/ab251455.*)
	for i in $LIST
	do
		runcommand $i
	done
fi
- ----------------
This will allow you to issue your command on the individual file. 

- -- 
Jerry Feldman <gaf@blu.org>
Boston Linux and Unix user group
http://www.blu.org PGP key id:C5061EA9
PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)

iD8DBQE/yhCt+wA+1cUGHqkRAk/oAJsG9um8xgueeBhE8b5Q3dnM7lj6hwCeIHLx
AIAWBjY+dOF8QkChIap4Svk=
=ELxq
-----END PGP SIGNATURE-----

-- 
Check the headers for your unsubscription address
For additional commands send e-mail to suse-linux-e-help@suse.com
Also check the archives at http://lists.suse.com
Please read the FAQs: suse-linux-e-faq@suse.com


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic