aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlib/keyringer/actions/recipients4
-rwxr-xr-xlib/keyringer/functions11
2 files changed, 12 insertions, 3 deletions
diff --git a/lib/keyringer/actions/recipients b/lib/keyringer/actions/recipients
index 3c18516..889f73e 100755
--- a/lib/keyringer/actions/recipients
+++ b/lib/keyringer/actions/recipients
@@ -38,7 +38,9 @@ elif [ "$COMMAND" == "edit" ]; then
keyringer_exec git "$BASEDIR" add "$RECIPIENTS_FILE_BASE"
else
echo "Please specify one recipient to edit among the available:"
- ls $RECIPIENTS | sed -e 's/^/\t/'
+ # \t is a GNU extension
+ # https://stackoverflow.com/questions/8400602/sed-replace-literal-tab
+ ls $RECIPIENTS | sed -e "`printf 's/^/\t/'`"
exit 1
fi
else
diff --git a/lib/keyringer/functions b/lib/keyringer/functions
index e3f89d9..b1e2e08 100755
--- a/lib/keyringer/functions
+++ b/lib/keyringer/functions
@@ -537,7 +537,12 @@ function keyringer_show_actions {
# Usage
function keyringer_usage {
- local keyrings="$(ls --color=never `dirname $CONFIG` | sed -e 's/config//' | xargs)"
+ # are we're using an `ls` that supports `--color`?
+ if ls --version 2>/dev/null; then
+ local keyrings="$(ls --color=never `dirname $CONFIG` | sed -e 's/config//' | xargs)"
+ else
+ local keyrings="$(ls `dirname $CONFIG` | sed -e 's/config//' | xargs)"
+ fi
printf "Keyringer $KEYRINGER_VERSION\n"
printf "Usage: keyringer <keyring> <action> [arguments]\n\n"
@@ -552,7 +557,9 @@ function keyringer_usage {
if [ ! -z "$keyrings" ] && [ -z "$1" ]; then
printf "\tinit <path> [remote]\n" $BASENAME
fi
- keyringer_show_actions | sed -e 's/^/\t/'
+ # \t is a GNU extension
+ # https://stackoverflow.com/questions/8400602/sed-replace-literal-tab
+ keyringer_show_actions | sed -e "`printf 's/^/\t/'`"
printf "\n"
}