From 9988f4033dd0af225e65b631e585032c57e15e11 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 18 Jun 2017 16:24:18 +1200 Subject: Break plenv stuff into its own target --- sh/profile.d/plenv.sh | 5 ----- sh/shrc.d/plenv.sh | 17 ----------------- 2 files changed, 22 deletions(-) delete mode 100644 sh/profile.d/plenv.sh delete mode 100644 sh/shrc.d/plenv.sh (limited to 'sh') 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/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 -} -- cgit v1.2.3 From 4722948a5657d3a2596d408d551ab03c5085d0ec Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 18 Jun 2017 16:30:14 +1200 Subject: More segmentation/tidying --- sh/profile.d/keychain.sh | 5 ----- sh/shrc.d/keychain.sh | 4 ---- 2 files changed, 9 deletions(-) delete mode 100644 sh/profile.d/keychain.sh delete mode 100644 sh/shrc.d/keychain.sh (limited to 'sh') 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/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 -- cgit v1.2.3 From e71182ce0b1076f52799534bfed023c75e03e412 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 19 Jun 2017 00:28:06 +1200 Subject: Remove user@ prefix from prompt --- sh/shrc.d/prompt.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sh') diff --git a/sh/shrc.d/prompt.sh b/sh/shrc.d/prompt.sh index f1b67fb4..6f1e8e1f 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)'$ ' fi -- cgit v1.2.3 From b68feacb05cef1ecc41fe55460a8e1028cedb12a Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 23 Jun 2017 08:28:00 +1200 Subject: Add ed() options file check --- sh/shrc.d/ed.sh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sh') 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() { -- cgit v1.2.3 From a62fb7bac4a43c105c54fd19511b7fe9ae6cc706 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 23 Jun 2017 08:28:11 +1200 Subject: Fix up an error message --- sh/shrc.d/hgrep.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sh') 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" -- cgit v1.2.3 From 3cc9a3d4d72c0335895f2bf9678eac2b24d425ec Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 24 Jun 2017 16:21:33 +1200 Subject: Use short hostname in default prompt --- sh/shrc.d/prompt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sh') diff --git a/sh/shrc.d/prompt.sh b/sh/shrc.d/prompt.sh index 6f1e8e1f..30e4e9d8 100644 --- a/sh/shrc.d/prompt.sh +++ b/sh/shrc.d/prompt.sh @@ -7,5 +7,5 @@ PS1='$ ' PS2='> ' PS3='? ' PS4='+ ' # If we have an SSH_CLIENT or SSH_CONNECTION environment variable, put the # hostname in PS1 too. if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_CONNECTION" ] ; then - PS1=$(hostname)'$ ' + PS1=$(hostname -s)'$ ' fi -- cgit v1.2.3 From 7859b833eab9ed32d2b438e1b5cc534b830118db Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 30 Jun 2017 10:27:06 +1200 Subject: Remove env(1) sorting Not worth the potential confusion. If I want nice sorted information I can either pipe it through sort myself, or use `declare -px` in Bash. --- sh/shrc.d/env.sh | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 sh/shrc.d/env.sh (limited to 'sh') 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 -} -- cgit v1.2.3 From 7d86a4bca3500885cd2f9b11cd97688685ccb7c5 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 1 Jul 2017 22:16:55 +1200 Subject: Put local gamesdir at end of PATH So that if anything actually important has the same name, that's used instead --- sh/profile.d/games.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sh') 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 -- cgit v1.2.3 From ab6cb2673a51f8582e82828b15fd62f303f54d75 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 11 Jul 2017 23:57:23 +1200 Subject: Gracefully handle two failed tput color calls --- sh/shrc.d/grep.sh | 2 +- sh/shrc.d/ls.sh | 2 +- sh/shrc.d/tree.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'sh') 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/ls.sh b/sh/shrc.d/ls.sh index b5acfcf9..d58c64f9 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/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 "$@" -- cgit v1.2.3 From cd7a8c2433182ee147380318008a81a839f65596 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 26 Jul 2017 08:59:46 +1200 Subject: Adjust linebreak behaviour around downloads check --- sh/profile.d/downloads.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sh') 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' ) -- cgit v1.2.3