[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [leafnode-list] Re: Fetchnews and Shell Script
--T4sUOijqQbZv57TR
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
Also sprach Stefan Troeger (in <38DD3F10.BeroList-2.5.9@xxxxxxxxxxxxxxxxxxx=
rzburg.de>):
> On Sat, Mar 25 2000 at 14:53 -0600, John R. Dennison wrote:
>=20
> > #!/bin/sh
> >=20
> > cd /var/spool/news/out.going
> >=20
> > if [ -f * ]
> > then
> > echo "executing fetchnews -P"
> > /usr/local/sbin/fetchnews -P
> > exit $?
> > fi
> >=20
> > exit 0
>=20
> Depending on the shell you're using this may work or not. It does
> fine in zsh, but in bash it will only work if there are less then
> two files that match *:
>=20
> [sttr]/home/sttr/1> touch foo bar com
> [sttr]/home/sttr/1> if [ -f * ]; then echo; fi
> [: too many arguments
This is correct, as far as I recall. The Bourne-Shell * creates multiple
arguments, one for each file. test, on the other hand wants exactly one
argument for -f.
As I tend to use perl for everything, I propose:
-- schnipp --
#!/usr/bin/perl
chdir('/var/spool/news/out.going');
exit unless (glob('*') eq '*');
print("executing fetchnews -P");
exec("/usr/local/sbin/fetchnews -P");
-- schnipp --
cu
AW
--=20
Neulich in detebe:
>... und ewig loggt das Weib?
--T4sUOijqQbZv57TR
Content-Type: application/pgp-signature
-----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia
iQCVAwUBON35KsCaUV487z8dAQHa1QQAjSReNFh37PNoCUfiEVXIkFtGPnD/SxO6
IO3/CRLNIlc0p+zj03AKWBiMO6+CBplGdp1HnS6txGw9ACgyXsard0/rsT47+9E4
s4Coiu99FLr2OKGD/0fst9gX3Uc+mysxZRk61nWD05K/rZ8cGwrw3orDAITlvwY6
6i/YdKeHMKI=
=jXhj
-----END PGP SIGNATURE-----
--T4sUOijqQbZv57TR--
--
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list