summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrysiek <rysiek@example.org>2017-11-03 10:38:46 -0200
committerSilvio Rhatto <rhatto@riseup.net>2017-11-03 10:38:46 -0200
commit9363e1fa91b23297f13d51139203baf5a0090fc0 (patch)
treed422fe5a0f0eb650ee219ed559b6f5939d4246aa
parent1895a47f2bdf4064787b57b5a68d6b3656a620d0 (diff)
downloadkeyringer-9363e1fa91b23297f13d51139203baf5a0090fc0.tar.gz
keyringer-9363e1fa91b23297f13d51139203baf5a0090fc0.tar.bz2
\t is a GNU extension in sed regexes; fixed / use --color only when ls supports it
-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"
}