From efd95c34c7db7686600571243ca00196276fa0ad Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 12 Apr 2017 09:51:27 +1200 Subject: Use more logical ~/.cache subpath --- sh/profile.d/options.sh | 2 +- sh/shrc.d/bc.sh | 4 ++-- sh/shrc.d/ed.sh | 2 +- sh/shrc.d/grep.sh | 14 +++++++------- sh/shrc.d/la.sh | 2 +- sh/shrc.d/ll.sh | 2 +- sh/shrc.d/ls.sh | 8 ++++---- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/sh/profile.d/options.sh b/sh/profile.d/options.sh index 1a511d75..89b5d245 100644 --- a/sh/profile.d/options.sh +++ b/sh/profile.d/options.sh @@ -5,7 +5,7 @@ options() { # Check or create the directory to cache the options # Shift the program name off; remaining arguments are the options to check - dir=$HOME/.cache/$1 + dir=$HOME/.cache/sh/opt/$1 prog=$1 shift diff --git a/sh/shrc.d/bc.sh b/sh/shrc.d/bc.sh index 41331ff9..aee88e09 100644 --- a/sh/shrc.d/bc.sh +++ b/sh/shrc.d/bc.sh @@ -1,12 +1,12 @@ # Our ~/.profile should already have made a directory with the supported # options for us; if not, we won't be wrapping bc(1) with a function at all -[ -d "$HOME"/.cache/bc ] || return +[ -d "$HOME"/.cache/sh/opt/bc ] || return # Define function proper bc() { # Add --quiet to stop the annoying welcome banner - [ -e "$HOME"/.cache/bc/quiet ] && + [ -e "$HOME"/.cache/sh/opt/bc/quiet ] && set -- --quiet "$@" # Run bc(1) with the concluded arguments diff --git a/sh/shrc.d/ed.sh b/sh/shrc.d/ed.sh index d7d3fa2f..a2b7818e 100644 --- a/sh/shrc.d/ed.sh +++ b/sh/shrc.d/ed.sh @@ -8,7 +8,7 @@ ed() { fi # Add --verbose to explain errors - [ -e "$HOME"/.cache/ed/verbose ] && + [ -e "$HOME"/.cache/sh/opt/ed/verbose ] && set -- --verbose "$@" # Add an asterisk prompt (POSIX feature) diff --git a/sh/shrc.d/grep.sh b/sh/shrc.d/grep.sh index fc8f62c0..dd85a198 100644 --- a/sh/shrc.d/grep.sh +++ b/sh/shrc.d/grep.sh @@ -1,6 +1,6 @@ # Our ~/.profile should already have made a directory with the supported # options for us; if not, we won't be wrapping grep(1) with a function at all -[ -d "$HOME"/.cache/grep ] || return +[ -d "$HOME"/.cache/sh/opt/grep ] || return # Discard GNU grep(1) environment variables if the environment set them unset -v GREP_OPTIONS @@ -9,31 +9,31 @@ unset -v GREP_OPTIONS grep() { # Add --binary-files=without-match to gracefully skip binary files - [ -e "$HOME"/.cache/grep/binary-files ] && + [ -e "$HOME"/.cache/sh/opt/grep/binary-files ] && set -- --binary-files=without-match "$@" # Add --color=auto if the terminal has at least 8 colors - [ -e "$HOME"/.cache/grep/color ] && + [ -e "$HOME"/.cache/sh/opt/grep/color ] && [ "$({ tput colors || tput Co ; } 2>/dev/null)" -ge 8 ] && set -- --color=auto "$@" # Add --devices=skip to gracefully skip devices - [ -e "$HOME"/.cache/grep/devices ] && + [ -e "$HOME"/.cache/sh/opt/grep/devices ] && set -- --devices=skip "$@" # Add --directories=skip to gracefully skip directories - [ -e "$HOME"/.cache/grep/directories ] && + [ -e "$HOME"/.cache/sh/opt/grep/directories ] && set -- --directories=skip "$@" # Add --exclude to ignore .gitignore and .gitmodules files - [ -e "$HOME"/.cache/grep/exclude ] && + [ -e "$HOME"/.cache/sh/opt/grep/exclude ] && set -- \ --exclude=.gitignore \ --exclude=.gitmodules \ "$@" # Add --exclude-dir to ignore version control dot-directories - [ -e "$HOME"/.cache/grep/exclude-dir ] && + [ -e "$HOME"/.cache/sh/opt/grep/exclude-dir ] && set -- \ --exclude-dir=.cvs \ --exclude-dir=.git \ diff --git a/sh/shrc.d/la.sh b/sh/shrc.d/la.sh index e21ad8fb..1ac44b8e 100644 --- a/sh/shrc.d/la.sh +++ b/sh/shrc.d/la.sh @@ -1,7 +1,7 @@ # Run ls -A if we can (-A is not POSIX), ls -a otherwise la() { # Prefer --almost-all (exclude "." and "..") if available - if [ -e "$HOME"/.cache/ls/almost-all ] ; then + if [ -e "$HOME"/.cache/sh/opt/ls/almost-all ] ; then set -- -A "$@" else set -- -a "$@" diff --git a/sh/shrc.d/ll.sh b/sh/shrc.d/ll.sh index c8c95d3b..e9737c62 100644 --- a/sh/shrc.d/ll.sh +++ b/sh/shrc.d/ll.sh @@ -1,7 +1,7 @@ # Run ls -Al if we can (-A is not POSIX), ls -al otherwise ll() { # Prefer -A/--almost-all (exclude "." and "..") if available - if [ -e "$HOME"/.cache/ls/almost-all ] ; then + if [ -e "$HOME"/.cache/sh/opt/ls/almost-all ] ; then set -- -Al "$@" else set -- -al "$@" diff --git a/sh/shrc.d/ls.sh b/sh/shrc.d/ls.sh index 18f50a8b..b5acfcf9 100644 --- a/sh/shrc.d/ls.sh +++ b/sh/shrc.d/ls.sh @@ -1,6 +1,6 @@ # Our ~/.profile should already have made a directory with the supported # options for us; if not, we won't be wrapping ls(1) with a function at all -[ -d "$HOME"/.cache/ls ] || return +[ -d "$HOME"/.cache/sh/opt/ls ] || return # If the system has already aliased ls(1) for us, like Slackware or OpenBSD # does, just get rid of it @@ -20,17 +20,17 @@ ls() { [ -t 1 ] && set -- -x "$@" # Add --block-size=K to always show the filesize in kibibytes - [ -e "$HOME"/.cache/ls/block-size ] && + [ -e "$HOME"/.cache/sh/opt/ls/block-size ] && set -- --block-size=1024 "$@" # Add --color if the terminal has at least 8 colors - [ -e "$HOME"/.cache/ls/color ] && + [ -e "$HOME"/.cache/sh/opt/ls/color ] && [ "$({ tput colors || tput Co ; } 2>/dev/null)" -ge 8 ] && set -- --color=auto "$@" # Add --time-style='+%Y-%m-%d %H:%M:%S' to show the date in my preferred # (fixed) format - [ -e "$HOME"/.cache/ls/time-style ] && + [ -e "$HOME"/.cache/sh/opt/ls/time-style ] && set -- --time-style='+%Y-%m-%d %H:%M:%S' "$@" # Run ls(1) with the concluded arguments -- cgit v1.2.3