diff options
author | Jarkko Kniivilä <jkniiv@gmail.com> | 2015-09-07 23:43:02 +0300 |
---|---|---|
committer | Mike Burns <mike@mike-burns.com> | 2015-11-01 16:54:34 +0100 |
commit | 5f592878eed79dd28f9f93418f9456185fd21ac9 (patch) | |
tree | 1e79fe49cbac3485bb0d25df3e9aca1f814d1e6e /bin | |
parent | 39a32b9295c10176eeca3f21534caa0209cb1172 (diff) |
Do not depend on readlink(1) or -q
Solaris 10 lacks readlink(1). Additionally, its different grep(1) and
diff(1) do not take a `-q` flag.
Use a Perl one-liner instead of readlink(1) which is missing on Solaris 10.
Also because /usr/bin/grep and diff(1) don't understand the `-q` option, make
them go quiet by redirecting stdout to `/dev/null` instead.
The Perl dependency only exists in the test suite, so it does not incur
a runtime penalty for end users.
This is to work around the fact that readlink(1) is missing on Solaris.
The tradeoff is: on Solaris, installing third-party software (readlink)
is a pain, whereas on e.g. FreeBSD installing third-party software
(Perl) is simple and common.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/lsrc.in | 4 | ||||
-rwxr-xr-x | bin/rcup.in | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/bin/lsrc.in b/bin/lsrc.in index 47ae889..fcf5fbe 100755 --- a/bin/lsrc.in +++ b/bin/lsrc.in @@ -118,7 +118,7 @@ show_file() { output="$output:$sigil" fi - if echo "$DEST_STACK:" | grep -vq ":$dest_file:"; then + if echo "$DEST_STACK:" | grep -v ":$dest_file:" >/dev/null; then DEST_STACK="$DEST_STACK:$dest_file" $PRINT "$output" else @@ -167,7 +167,7 @@ dotfiles_dir_excludes() { $DEBUG " with excludes: $excludes" for exclude in $excludes; do - if echo "$exclude" | grep -q ':'; then + if echo "$exclude" | grep ':' >/dev/null; then dotfiles_dir_pat="$(echo "$exclude" | sed 's/:.*//')" file_glob="$(echo "$exclude" | sed 's/.*://')" diff --git a/bin/rcup.in b/bin/rcup.in index f818258..bdae664 100755 --- a/bin/rcup.in +++ b/bin/rcup.in @@ -123,11 +123,11 @@ replace_file() { } is_nested() { - echo "$1" | sed "s:$DEST_DIR/::" | grep -q '/' + echo "$1" | sed "s:$DEST_DIR/::" | grep '/' >/dev/null } is_identical() { - diff -q -s "$1" "$2" > /dev/null + diff -c "$1" "$2" > /dev/null 2>&1 } handle_dir() { |