[nzlug] File Server Cost Analysis
Jasper Bryant-Greene
jasper at albumltd.co.nz
Tue Mar 20 18:21:52 NZST 2007
Michael Adams wrote:
> On Tue, 20 Mar 2007 11:09:27 +1200 (NZST)
> Matthew Poole wrote:
>> There're a few tests you can do in bash to check for existence. -d
>> checks for a directory, -f tests for a file, -e tests simply for
>> existence.. So you could have a file on the backup device that's not
>> writeable, so it can't be deleted, and just check to see if it's
>> there. Something like if [ ! -e "/path/to/file" ]; then echo "Backup
>> device not present"; exit 0; fi
>>
>
> So flipped over it looks like.
>
> if [-e "/path/to/file" ];
> # run backup here
> exit 0;
> fi
>
Don't forget the space after [. [ is a command just like any other and
therefore requires a space before it's args :)
Also 'then' is not optional.
--
Jasper Bryant-Greene 0800 425 286
Director jasper at albumltd.co.nz
Album Limited www.albumltd.co.nz
More information about the NZLUG
mailing list