Linux.com

tar portability

Posted by: Anonymous Coward on January 24, 2006 04:18 AM
In the examples below, I have tried to avoid GNU-specific idioms for tools which have non-GNU counterparts. This practice improves portability of shell scripts in heterogeneous environments.

Good:
<tt>tar cf - dirname |<nobr> <wbr></nobr>...</tt>
Not good:
<nobr> <wbr></nobr>
<tt>... | tar xv</tt>
On some platforms, you need to explicitly specify stdin. For example, NetBSD tar tries to read from<nobr> <wbr></nobr>/dev/nrst0. A better form would be:
<nobr> <wbr></nobr>
<tt>... | tar xfv -</tt>
Also, be aware that not all implementations of tar have the -z and -j options for gzip and bzip2 compression.

#

Return to CLI Magic: OpenSSH + Bash