launch a command only if

Hi!
I would launch this command:

tar -cvvf logswitch.tar `find *.log* -mtime +5` --remove-files

only if

find *.log* -mtime +5

find some files.

Thanks in advance.

tar -cvvf logswitch.tar `find . -type f -name \*.log\* -mtime +5` --remove-files

Assuming the fles are in or below the directory . (current dir)

Thanks I'll try.

FILES=$(find *.log* -mtime +5)
if [[ "$FILES"  != "" ]]; then tar -cvvf logswitch.tar $FILES --remove-files; else echo NO FILES FOUND; fi

I assume you don't want the file to be created if no files are given.
$(FILES)=$(find .....)
[[ -z $FILES ]] || tar ... $(FILES)

mmmm... Good one.
The syntax is not correct though, at least for ksh/bash... It should read:

FILES=$(find .....)
[[ -z "$FILES" ]] || tar ... $FILES

Regards.

Thanx!
Whoops sorry, my perl background is showing:-)

The problem is that I'm using a perl module (expect) to send the command and like so it doesn't works!
These are the commands that I use:

$cmd="tar -cvvf logswitch.tar `find *.log* -mtime +5` --remove-files";
print $ssh "$cmd\r";

you can still use the except module and write the following:
if the default shell is ksh
"(FILES=$(find ....) ; [[ -z $FILES ]] || tar ....)"

It doesn't work:

witch.tar `find *.log* -mtime +5` --remove-files)5); [[ -z ]] || tar -cvvf logs
-bash: unexpected argument `]]' to conditional unary operator
-bash: syntax error near `]]'

I can use only bash.

"(FILES=$(find ....) ; [ -z \"$FILES\" ] || tar ....)"