Hi Thomas,
I just revisited this and first, it seems I must offer my apologies: It appears I tested the case for the deleted file with the "or" clause and got ENDED_OK, but I probably tested the "file exists" case when I got ENDED_OK without the "or" clause. That's the only explaination I have because as of today, I am getting the same error you get when the file exists.
It appears Automic runs the shell code in an arbitary way and somehow, unlike the pure shell statement would, it screws up when you have the "or" clause and the file exists. I experimented with an "if" statement instead, but that got even more useless results. On a side note, it appears they also truncate the shell code, which can be demonstrated by using this:
CMD=cat /tmp/testfile.txt ; cat /tmp/testfile.txt
This should print the contents of testfile.txt twice, but it prints it only once. This whole PREP_PROCESS contruct is, in my view, a crutch that follows arbitary rules and I consider it broken, but I'm convincied Automic would argue it's by design.
As for your matter, since they can't do compound commands, you might want to consider putting that command into a shell script and calling that. Either with an "or" or "if" clause that echoes back a string if deletion failed, which you can then process via &HND#. Here's the "if" example:
#!/bin/bash
if [ -f /tmp/testfile.txt ] ; then
cat /tmp/testfile
else
echo "deleted"
fi
Maybe you can use $1 as a parameter for the filename and pass that from AE if you want to parameterize the filename. You'd have to try how badly Automic butchers that command string.
Best regards,
Carsten