aboutsummaryrefslogtreecommitdiff
path: root/sh/shrc.d
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-07-28 16:00:57 +1200
committerTom Ryder <tom@sanctum.geek.nz>2017-07-28 16:00:57 +1200
commitc206e46c9afbc0baeeb5828e4aff9888558b104d (patch)
treecf8e857ab557a591a2431659dc391dfb11b587c4 /sh/shrc.d
parentMerge branch 'master' into port/bsd/freebsd (diff)
parentAdjust linebreak behaviour around downloads check (diff)
downloaddotfiles-c206e46c9afbc0baeeb5828e4aff9888558b104d.tar.gz
dotfiles-c206e46c9afbc0baeeb5828e4aff9888558b104d.zip
Merge branch 'master' into port/bsd/freebsd
Diffstat (limited to 'sh/shrc.d')
-rw-r--r--sh/shrc.d/ed.sh4
-rw-r--r--sh/shrc.d/env.sh8
-rw-r--r--sh/shrc.d/grep.sh2
-rw-r--r--sh/shrc.d/hgrep.sh2
-rw-r--r--sh/shrc.d/keychain.sh4
-rw-r--r--sh/shrc.d/ls.sh2
-rw-r--r--sh/shrc.d/plenv.sh17
-rw-r--r--sh/shrc.d/prompt.sh4
-rw-r--r--sh/shrc.d/tree.sh2
9 files changed, 10 insertions, 35 deletions
diff --git a/sh/shrc.d/ed.sh b/sh/shrc.d/ed.sh
index a2b7818e..e6b6eee8 100644
--- a/sh/shrc.d/ed.sh
+++ b/sh/shrc.d/ed.sh
@@ -1,3 +1,7 @@
+# Our ~/.profile should already have made a directory with the supported
+# options for us; if not, we won't be wrapping ed(1) with a function at all
+[ -d "$HOME"/.cache/sh/opt/ed ] || return
+
# Define function proper
ed() {
diff --git a/sh/shrc.d/env.sh b/sh/shrc.d/env.sh
deleted file mode 100644
index 4fa980f2..00000000
--- a/sh/shrc.d/env.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-# Sort the output of env(1) for me
-env() {
- if [ "$#" -eq 0 ] ; then
- command env | sort
- else
- command env "$@"
- fi
-}
diff --git a/sh/shrc.d/grep.sh b/sh/shrc.d/grep.sh
index dd85a198..3df1ee9a 100644
--- a/sh/shrc.d/grep.sh
+++ b/sh/shrc.d/grep.sh
@@ -14,7 +14,7 @@ grep() {
# Add --color=auto if the terminal has at least 8 colors
[ -e "$HOME"/.cache/sh/opt/grep/color ] &&
- [ "$({ tput colors || tput Co ; } 2>/dev/null)" -ge 8 ] &&
+ [ "$({ tput colors||tput Co||echo 0; } 2>/dev/null)" -ge 8 ] &&
set -- --color=auto "$@"
# Add --devices=skip to gracefully skip devices
diff --git a/sh/shrc.d/hgrep.sh b/sh/shrc.d/hgrep.sh
index fe297ab3..9d7542b4 100644
--- a/sh/shrc.d/hgrep.sh
+++ b/sh/shrc.d/hgrep.sh
@@ -9,7 +9,7 @@ hgrep() {
return 2
fi
if [ -z "$HISTFILE" ] ; then
- printf >&2 'hgrep(): No HISTFILE\n'
+ printf >&2 'hgrep(): HISTFILE unset or null\n'
return 2
fi
grep "$@" "$HISTFILE"
diff --git a/sh/shrc.d/keychain.sh b/sh/shrc.d/keychain.sh
deleted file mode 100644
index 9a732384..00000000
--- a/sh/shrc.d/keychain.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-# If GPG_AGENT_INFO is set, update GPG_TTY for clean use of pinentry(1) etc
-[ -n "$GPG_AGENT_INFO" ] || return
-GPG_TTY=$(command -p tty) || return
-export GPG_TTY
diff --git a/sh/shrc.d/ls.sh b/sh/shrc.d/ls.sh
index 40a0a5ce..7e843cc7 100644
--- a/sh/shrc.d/ls.sh
+++ b/sh/shrc.d/ls.sh
@@ -25,7 +25,7 @@ ls() {
# Add --color if the terminal has at least 8 colors
[ -e "$HOME"/.cache/sh/opt/ls/color ] &&
- [ "$({ tput colors || tput Co ; } 2>/dev/null)" -ge 8 ] &&
+ [ "$({ tput colors||tput Co||echo 0; } 2>/dev/null)" -ge 8 ] &&
set -- --color=auto "$@"
# Add --time-style='+%Y-%m-%d %H:%M:%S' to show the date in my preferred
diff --git a/sh/shrc.d/plenv.sh b/sh/shrc.d/plenv.sh
deleted file mode 100644
index 6e03618e..00000000
--- a/sh/shrc.d/plenv.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-# POSIX-compatible version of the plenv Bash shell wrapper
-[ -d "$HOME"/.plenv ] || return
-plenv() {
- case $1 in
- rehash)
- shift
- eval "$(plenv sh-rehash "$@")"
- ;;
- shell)
- shift
- eval "$(plenv sh-shell "$@")"
- ;;
- *)
- command plenv "$@"
- ;;
- esac
-}
diff --git a/sh/shrc.d/prompt.sh b/sh/shrc.d/prompt.sh
index f1b67fb4..30e4e9d8 100644
--- a/sh/shrc.d/prompt.sh
+++ b/sh/shrc.d/prompt.sh
@@ -5,7 +5,7 @@ unset PS1 PS2 PS3 PS4
PS1='$ ' PS2='> ' PS3='? ' PS4='+ '
# If we have an SSH_CLIENT or SSH_CONNECTION environment variable, put the
-# username and hostname in PS1 too.
+# hostname in PS1 too.
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_CONNECTION" ] ; then
- PS1=$(id -nu)'@'$(hostname)'$ '
+ PS1=$(hostname -s)'$ '
fi
diff --git a/sh/shrc.d/tree.sh b/sh/shrc.d/tree.sh
index b4f91df8..ca134fe2 100644
--- a/sh/shrc.d/tree.sh
+++ b/sh/shrc.d/tree.sh
@@ -21,7 +21,7 @@ tree() {
[ -t 1 ] || exit
# Not if output terminal doesn't have at least 8 colors
- [ "$({ tput colors || tput Co ; } 2>/dev/null)" -ge 8 ] || exit
+ [ "$({ tput colors||tput Co||echo 0; } 2>/dev/null)" -ge 8 ]
) ; then
set -- -C "$@"