Quote:
Hmm. I wonder if that's the problem -- that his test case had less than two characters.

No, the test string was about 20 chars so no problem there. Actually I'm not sure if that would be a problem anyway, but in any case not applicable here.

I think the important point here is that the code I used only fails when used in a script, whereas there is NO error when used directly on the command line (nor on my RedHat machine in any circumstances). This is the puzzle, that there is a totally different result when using these 2 methods.

As I said, I'm resigned to figuring a 'get around' as I doubt the empeg bash will get upgraded, but thanks for the support anyway.