diff options
author | Arun Prakash Jana <engineerarun@gmail.com> | 2019-11-22 02:14:25 +0530 |
---|---|---|
committer | Arun Prakash Jana <engineerarun@gmail.com> | 2019-11-22 11:13:34 +0530 |
commit | 1cca9e4b72b106374f203890b266f18609deefe3 (patch) | |
tree | 9f281f4b4de296c54d13dc9c7e214f58835636a7 /misc | |
parent | ee2dcb1de7d3e82b330f49ee9fb5dfd4608207ff (diff) | |
download | nnn-1cca9e4b72b106374f203890b266f18609deefe3.tar.gz |
shellcheck fixes
Diffstat (limited to 'misc')
-rw-r--r-- | misc/auto-completion/bash/nnn-completion.bash | 5 | ||||
-rw-r--r-- | misc/quitcd/quitcd.bash | 18 | ||||
-rw-r--r-- | misc/quitcd/quitcd.zsh | 10 | ||||
-rwxr-xr-x | misc/test/mktest.sh | 2 |
4 files changed, 18 insertions, 17 deletions
diff --git a/misc/auto-completion/bash/nnn-completion.bash b/misc/auto-completion/bash/nnn-completion.bash index 22180e5..638df49 100644 --- a/misc/auto-completion/bash/nnn-completion.bash +++ b/misc/auto-completion/bash/nnn-completion.bash @@ -5,7 +5,8 @@ # Arun Prakash Jana <engineerarun@gmail.com> # -_nnn () { +_nnn () +{ COMPREPLY=() local IFS=$' \n' local cur=$2 prev=$3 @@ -36,7 +37,7 @@ _nnn () { COMPREPLY=( $(compgen -f -d -- "$cur") ) elif [[ $prev == -e ]]; then local sessions_dir=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/sessions - COMPREPLY=( $(compgen -W "$(ls $sessions_dir)" -- "$cur") ) + COMPREPLY=( $(compgen -W "$(ls "$sessions_dir")" -- "$cur") ) elif [[ $cur == -* ]]; then COMPREPLY=( $(compgen -W "${opts[*]}" -- "$cur") ) else diff --git a/misc/quitcd/quitcd.bash b/misc/quitcd/quitcd.bash index 70498cb..5c94b11 100644 --- a/misc/quitcd/quitcd.bash +++ b/misc/quitcd/quitcd.bash @@ -1,24 +1,24 @@ -n() +n () { # Block nesting of nnn in subshells - if [ $(expr $NNNLVL + 0) -ge 1 ]; then + if [ "$((NNNLVL + 0))" -ge 1 ]; then echo "nnn is already running" return fi + # The default behaviour is to cd on quit (nnn checks if NNN_TMPFILE is set) + # To cd on quit only on ^G, export NNN_TMPFILE after the call to nnn + export NNN_TMPFILE=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd + # Unmask ^Q (, ^V etc.) (if required, see `stty -a`) to Quit nnn # stty start undef # stty stop undef # stty lwrap undef - # The default behaviour is to cd on quit (nnn checks if NNN_TMPFILE is set) - # To cd on quit only on ^G, export NNN_TMPFILE after the call to nnn - export NNN_TMPFILE=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd - nnn "$@" - if [ -f $NNN_TMPFILE ]; then - . $NNN_TMPFILE - rm -f $NNN_TMPFILE > /dev/null + if [ -f "$NNN_TMPFILE" ]; then + . "$NNN_TMPFILE" + rm -f "$NNN_TMPFILE" > /dev/null fi } diff --git a/misc/quitcd/quitcd.zsh b/misc/quitcd/quitcd.zsh index 57f0fcf..5c94b11 100644 --- a/misc/quitcd/quitcd.zsh +++ b/misc/quitcd/quitcd.zsh @@ -1,7 +1,7 @@ -n() +n () { # Block nesting of nnn in subshells - if [ $(expr $NNNLVL + 0) -ge 1 ]; then + if [ "$((NNNLVL + 0))" -ge 1 ]; then echo "nnn is already running" return fi @@ -17,8 +17,8 @@ n() nnn "$@" - if [ -f $NNN_TMPFILE ]; then - . $NNN_TMPFILE - rm $NNN_TMPFILE + if [ -f "$NNN_TMPFILE" ]; then + . "$NNN_TMPFILE" + rm -f "$NNN_TMPFILE" > /dev/null fi } diff --git a/misc/test/mktest.sh b/misc/test/mktest.sh index 2d1decf..aa5a921 100755 --- a/misc/test/mktest.sh +++ b/misc/test/mktest.sh @@ -7,7 +7,7 @@ test -e outdir && { exit 1 } -mkdir -p outdir && cd outdir +mkdir -p outdir && cd outdir || exit 1 echo 'It works!' > normal.txt echo 'Με δουλέβει;' > 'κοινό.txt' |