diff options
Diffstat (limited to '')
-rwxr-xr-x | cat-nonbackups | 3 | ||||
-rwxr-xr-x | cat-nonbackups-with-head | 18 |
2 files changed, 21 insertions, 0 deletions
diff --git a/cat-nonbackups b/cat-nonbackups index 387cf7a..2031eab 100755 --- a/cat-nonbackups +++ b/cat-nonbackups @@ -8,6 +8,9 @@ good_filename () { test -n "$(printf '%s\n' "$1" | grep -v '^\.#' || :)" || return 1 test -n "$(printf '%s\n' "$1" | grep -v '^#' || :)" || return 1 } +if test "$1" = "--"; then + shift 1 +fi for file; do if good_filename "$file" >/dev/null 2>/dev/null; then cat -- "$file" diff --git a/cat-nonbackups-with-head b/cat-nonbackups-with-head new file mode 100755 index 0000000..426a50f --- /dev/null +++ b/cat-nonbackups-with-head @@ -0,0 +1,18 @@ +#!/bin/sh +set -e +good_filename () { + test -n "$(printf '%s\n' "$1" | grep -v '~$' || :)" || return 1 + test -n "$(printf '%s\n' "$1" | grep -v '\.swo$' || :)" || return 1 + test -n "$(printf '%s\n' "$1" | grep -v '\.swp$' || :)" || return 1 + test -n "$(printf '%s\n' "$1" | grep -v '\.bak$' || :)" || return 1 + test -n "$(printf '%s\n' "$1" | grep -v '^\.#' || :)" || return 1 + test -n "$(printf '%s\n' "$1" | grep -v '^#' || :)" || return 1 +} +if test "$1" = "--"; then + shift 1 +fi +for file; do + if good_filename "$file" >/dev/null 2>/dev/null; then + samedrun "$0" cat-with-head -- "$file" + fi +done |