aboutsummaryrefslogtreecommitdiff
path: root/sh
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
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')
-rw-r--r--sh/profile.d/downloads.sh5
-rw-r--r--sh/profile.d/games.sh2
-rw-r--r--sh/profile.d/keychain.sh5
-rw-r--r--sh/profile.d/plenv.sh5
-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
13 files changed, 15 insertions, 47 deletions
diff --git a/sh/profile.d/downloads.sh b/sh/profile.d/downloads.sh
index fb8dd64a..865cb859 100644
--- a/sh/profile.d/downloads.sh
+++ b/sh/profile.d/downloads.sh
@@ -15,6 +15,7 @@ esac
# Count files in each directory, report if greater than zero
(
+ lc=0
while IFS= read -r dir ; do
case $dir in
'#'*) continue ;;
@@ -23,6 +24,8 @@ esac
set -- "$dir"/*
[ -e "$1" ] || shift
[ "$#" -gt 0 ] || continue
- printf '\nYou have %u unsorted files in %s.\n\n' "$#" "$dir"
+ printf 'You have %u unsorted files in %s.\n' "$#" "$dir"
+ lc=$((lc+1))
done < "$HOME"/.downloads
+ [ "$((lc > 0))" -eq 1 ] && printf '\n'
)
diff --git a/sh/profile.d/games.sh b/sh/profile.d/games.sh
index ee56c593..956d1de1 100644
--- a/sh/profile.d/games.sh
+++ b/sh/profile.d/games.sh
@@ -1,3 +1,3 @@
# Add ~/.local/games to PATH if it exists
[ -d "$HOME"/.local/games ] || return
-PATH=$HOME/.local/games:$PATH
+PATH=$PATH:$HOME/.local/games
diff --git a/sh/profile.d/keychain.sh b/sh/profile.d/keychain.sh
deleted file mode 100644
index f3d25c62..00000000
--- a/sh/profile.d/keychain.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-# keychain setup
-command -v keychain >/dev/null 2>&1 || return
-eval "$(TERM=${TERM:-ansi} keychain \
- --eval --ignore-missing --quick --quiet \
- id_dsa id_rsa id_ecsda)"
diff --git a/sh/profile.d/plenv.sh b/sh/profile.d/plenv.sh
deleted file mode 100644
index b2b491e1..00000000
--- a/sh/profile.d/plenv.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-# Add plenv to PATH and MANPATH if it appears to be in use
-[ -d "$HOME"/.plenv ] || return
-PATH=$HOME/.plenv/shims:$HOME/.plenv/bin:$PATH
-MANPATH=$HOME/.plenv/versions/$(perl -e 'print substr($^V,1)')/man:$MANPATH
-export MANPATH
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 "$@"