[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: AIDE problems



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

Am Mittwoch, 11. Februar 2004 18:49 schrieb Keith Nasman:

> CONFFILE="/floppy/aide/aide.conf"
> DATABASE=`grep "^database=file:/" $CONFFILE | head -1 | cut -d:
> -f2` [ -z "$DATABASE" ] && DATABASE="/var/lib/aide/aide.db"
>
>
> So the conf file path is correct. The second line parses
> database=file:/floppy/aide/aide.db to "/floppy/aide/aide.db" which
> is correct. The third line gets a bit beyond my knowledge of bash
> scripting, I assume it means that if the file the $DATABASE
> variable points to doesn't exist, then set $DATABASE to
> /var/lib/aide/aide.db.

I don't know regex, but I know, If you do an && between two commands, 
the second is executed if the first is ok. This means if Database 
exists, set the variable to the other Path.

You can do:

[ -z "$DATABASE" ] || DATABASE="/var/lib/aide/aide.db"

or

[ -z ! "$DATABASE" ] && DATABASE="/var/lib/aide/aide.db"

I think the first would be better, but I`m drunken.

- -- 
MfG usw.

Werner Mahr
registered Linuxuser: 295882
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAKq6A1jkT71DQrmARAnesAJ4ht1G90DEAqmJAFng0Ds+70cwvdgCfWKR9
1iNbjXf78SlZFFyLgqnsyEY=
=tWiS
-----END PGP SIGNATURE-----



Reply to: