Base system utilities can vary across operating systems. Here's some quick notes to help with fixing issues that come up. Typically these come from scripts that assume GNU coreutils.
`sort -R
` (a.k.a. `sort --sort=random
`) isn't specified by POSIX, and you'll get wildly unexpected results on Mac OSX and NetBSD. The fastest-running solution is to install and use shuf(1), part of GNU coreutils. There are a few other good solutions here as well: Stack Overflow
This one will break any backup scripts if you use files to store exclusion lists. Best bet is to install a different tar package. You can check if your tar supports --exclude-from by running `tar --version
`. `bsdtar
` and `tar (GNU tar)
` will run as expected, as will NetBSD's tar(1), which doesn't support --version but you can check uname to see if you're on a NetBSD box.
One solution is to use the next best thing: tar -j
. Alternatively, you can install the xz package and pipe the archive to it via stdin for compression and redirect the result, `tar -f - <files> | xz --stdout > <archive.tar.xz>
`
\b
as a word boundary likely originated with Perl regular expressions, and are supported everywhere, except for OpenBSD. Instead use POSIX word boundaries [[:<:]]
and [[:>:]]
to match the beginning and ending of words, respectively.