diff options
Diffstat (limited to 'sh/shrc.d')
-rw-r--r-- | sh/shrc.d/bd.sh | 3 | ||||
-rw-r--r-- | sh/shrc.d/gd.sh | 3 | ||||
-rw-r--r-- | sh/shrc.d/grep.sh | 2 | ||||
-rw-r--r-- | sh/shrc.d/gt.sh | 3 | ||||
-rw-r--r-- | sh/shrc.d/mkcd.sh | 5 | ||||
-rw-r--r-- | sh/shrc.d/pd.sh | 3 | ||||
-rw-r--r-- | sh/shrc.d/prompt.sh | 17 | ||||
-rw-r--r-- | sh/shrc.d/rd.sh | 3 | ||||
-rw-r--r-- | sh/shrc.d/scr.sh | 3 | ||||
-rw-r--r-- | sh/shrc.d/sd.sh | 3 | ||||
-rw-r--r-- | sh/shrc.d/ud.sh | 3 | ||||
-rw-r--r-- | sh/shrc.d/vr.sh | 3 | ||||
-rw-r--r-- | sh/shrc.d/xd.sh | 2 |
13 files changed, 35 insertions, 18 deletions
diff --git a/sh/shrc.d/bd.sh b/sh/shrc.d/bd.sh index 29bde513..a942af6b 100644 --- a/sh/shrc.d/bd.sh +++ b/sh/shrc.d/bd.sh @@ -43,5 +43,6 @@ bd() { fi # We have a match; try and change into it - command cd -- "$1" + # shellcheck disable=SC2164 + cd -- "$1" } diff --git a/sh/shrc.d/gd.sh b/sh/shrc.d/gd.sh index 9f6a43e7..b9af480e 100644 --- a/sh/shrc.d/gd.sh +++ b/sh/shrc.d/gd.sh @@ -14,5 +14,6 @@ gd() { fi # Go to the marked directory - cd -- "$PMD" || return + # shellcheck disable=SC2164 + cd -- "$PMD" } diff --git a/sh/shrc.d/grep.sh b/sh/shrc.d/grep.sh index 997babc9..c448c81d 100644 --- a/sh/shrc.d/grep.sh +++ b/sh/shrc.d/grep.sh @@ -15,7 +15,7 @@ grep() { # Add --color=auto if the terminal has at least 8 colors if [ -e "$HOME"/.cache/sh/opt/grep/color ] && - [ "$({ tput colors||tput Co||echo 0; } 2>/dev/null)" -ge 8 ] ; then + [ "$(exec 2>/dev/null;tput colors||tput Co||echo 0)" -ge 8 ] ; then set -- --color=auto "$@" fi diff --git a/sh/shrc.d/gt.sh b/sh/shrc.d/gt.sh index 7a52571d..193a2996 100644 --- a/sh/shrc.d/gt.sh +++ b/sh/shrc.d/gt.sh @@ -24,5 +24,6 @@ gt() { fi # Try to change into the determined directory, or root if empty - command cd -- "${1:-/}" + # shellcheck disable=SC2164 + cd -- "${1:-/}" } diff --git a/sh/shrc.d/mkcd.sh b/sh/shrc.d/mkcd.sh index cd882b51..bfe8a142 100644 --- a/sh/shrc.d/mkcd.sh +++ b/sh/shrc.d/mkcd.sh @@ -1,5 +1,6 @@ # Create a directory and change into it mkcd() { - command -p mkdir -p -- "$1" || return - command cd -- "$1" + mkdir -p -- "$1" || return + # shellcheck disable=SC2164 + cd -- "$1" } diff --git a/sh/shrc.d/pd.sh b/sh/shrc.d/pd.sh index e3a6daaa..d5257ba5 100644 --- a/sh/shrc.d/pd.sh +++ b/sh/shrc.d/pd.sh @@ -27,5 +27,6 @@ pd() { set -- "${1%/*}" # Try to change into the determined directory, or root if empty - command cd -- "${1:-/}" + # shellcheck disable=SC2164 + cd -- "${1:-/}" } diff --git a/sh/shrc.d/prompt.sh b/sh/shrc.d/prompt.sh index 30e4e9d8..cb32c113 100644 --- a/sh/shrc.d/prompt.sh +++ b/sh/shrc.d/prompt.sh @@ -1,8 +1,15 @@ -# Some systems' /etc/profile setups export PS1, which really fouls things up -# when switching between non-login shells; let's put things right by unsetting -# it to break the export and then just setting them as simple variables -unset PS1 PS2 PS3 PS4 -PS1='$ ' PS2='> ' PS3='? ' PS4='+ ' +# Some systems' /etc/profile setups export their prompt strings (PS1, PS2...), +# which really fouls things up when switching between non-login shells; let's +# put things right by unsetting each of them to break the export, and then just +# setting them as simple variables +unset PS1 +PS1='$ ' +unset PS2 +PS2='> ' +unset PS3 +PS3='? ' +unset PS4 +PS4='+ ' # If we have an SSH_CLIENT or SSH_CONNECTION environment variable, put the # hostname in PS1 too. diff --git a/sh/shrc.d/rd.sh b/sh/shrc.d/rd.sh index 9633713a..5fbd5ac5 100644 --- a/sh/shrc.d/rd.sh +++ b/sh/shrc.d/rd.sh @@ -35,5 +35,6 @@ rd() { esac # Try to change into the determined directory - command cd -- "$1" + # shellcheck disable=SC2164 + cd -- "$1" } diff --git a/sh/shrc.d/scr.sh b/sh/shrc.d/scr.sh index 9af8dd74..14a58ad1 100644 --- a/sh/shrc.d/scr.sh +++ b/sh/shrc.d/scr.sh @@ -2,5 +2,6 @@ # files into $HOME, and making the system do cleanup for me. Single optional # argument is the string to use for naming the directory; defaults to "scr". scr() { - cd -- "$(mktd "${1:-scr}")" || return + # shellcheck disable=SC2164 + cd -- "$(mktd "${1:-scr}")" } diff --git a/sh/shrc.d/sd.sh b/sh/shrc.d/sd.sh index 8b12c170..58d1a375 100644 --- a/sh/shrc.d/sd.sh +++ b/sh/shrc.d/sd.sh @@ -113,5 +113,6 @@ sd() { esac # Try and change into the first parameter - command cd -- "$1" + # shellcheck disable=SC2164 + cd -- "$1" } diff --git a/sh/shrc.d/ud.sh b/sh/shrc.d/ud.sh index 06234569..f7f33caf 100644 --- a/sh/shrc.d/ud.sh +++ b/sh/shrc.d/ud.sh @@ -42,5 +42,6 @@ ud() { shift # Try to change into the determined directory, or the root if blank - command cd -- "${1:-/}" + # shellcheck disable=SC2164 + cd -- "${1:-/}" } diff --git a/sh/shrc.d/vr.sh b/sh/shrc.d/vr.sh index c7057ec2..d9cfda62 100644 --- a/sh/shrc.d/vr.sh +++ b/sh/shrc.d/vr.sh @@ -59,5 +59,6 @@ vr() { [ -n "$1" ] || return # Try to change into the determined directory - command cd -- "$@" + # shellcheck disable=SC2164 + cd -- "$@" } diff --git a/sh/shrc.d/xd.sh b/sh/shrc.d/xd.sh index 7c17adea..b26d88b3 100644 --- a/sh/shrc.d/xd.sh +++ b/sh/shrc.d/xd.sh @@ -8,7 +8,7 @@ xd() { fi # Complain if mark not actually set yet - if ! [ -n "$PMD" ] ; then + if [ -z "$PMD" ] ; then printf >&2 'gd(): Mark not set\n' return 1 fi |