tar c DIR | compress >DIR.tar.Z
which works on a Debian-based Linux, fails on SunOS.
tar tries to write to a tape device (/dev/rmt0 or such) if an output file isn't specified.
Default-stdout is a GNU tar change, but SunOS is not Linux and usually does not use GNU userspace; it's a bit more… traditional. Thus you need
tar cf - DIR instead.
compress command is not installed on the SunOS System.
I used the following command to zip files from SunOS:
tar cf - | gzip >myzip.zip
Because, systems may both be unixoid but linux is not SunOS is not HP-UX - although all have tar commands.