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/quitcd/quitcd.bash | |
parent | ee2dcb1de7d3e82b330f49ee9fb5dfd4608207ff (diff) | |
download | nnn-1cca9e4b72b106374f203890b266f18609deefe3.tar.gz |
shellcheck fixes
Diffstat (limited to 'misc/quitcd/quitcd.bash')
-rw-r--r-- | misc/quitcd/quitcd.bash | 18 |
1 files changed, 9 insertions, 9 deletions
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 } |