system( test -e filename ) on Solaris
I saw frequent error messages running the QC tool on GDO2, the Solaris machine which hosts most PCMDI CMIP5 data. For some files there was one message, for others none. The message was “sh: test: Argument expected”. This was a surprise to me because my shell was bash, and the QC scripts are written in bash.
After some time I discovered that the message comes from
QC::openAndLock(), at a line ”
system( test.cstr() )”. In this case the string is like
test="test -e filename". That’s a legal command in bash, but not in sh. The problem is that system() invokes /bin/sh, and on Solaris, /bin/sh is sh, the original Bourne shell. (On many other systems, I believe that /bin/sh is bash).
I suppose that the test string will have to be rewritten. There are other system() calls in the C++ code, but so far I have not seen any problems with the other ones.