AIX command help

I have this command in my script and it's working fine with AIX:

ls init?*.ora 2>/dev/null | egrep -i -e ""

the same command is failing in Solaris 10.

does anyone have better idea how to make it work for both ?

Thanks

What's the nature of the failure? What's the point of grepping for nothing (and really, what's the point of ignoring case in a string which doesn't have case!)? If you want to check if there was any output, even just an empty line, perhaps grep ^ would work on both platforms. But if ls works, the output should not have empty lines, so you could simply grep for a dot (meaning at least one character, any character).

(Just guessing that the problem is with egrep "" failing on Solaris. Perhaps you could check on that and report back.)

I would like to add to what era said that - AIX or not - this is the most awkward way to check for the existence of a file i have ever seen. Why not use something like:

if [ -f /your/file ] ; then
     <whatever you want to do with the file here>
else
     print -u2 "ERROR: file /your/file doe not exist!"
fi

"test -f" tests if the the file exists and is a regular file (not a directory, device file, etc.)

"test -r" tests if it exists and is readable

"test -w" tests if it exists and is writable

etc., see to man page for "test"

I hope this helps.

bakunin