diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-20 13:45:17 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-20 13:45:17 +1200 |
commit | 6f36a9e6494c723b209b253dfe3c83b62741c105 (patch) | |
tree | dc90d921978c517e3c2679c96f6a9db43ae31e6d /sh/shrc.d/cd.sh | |
parent | Move bd() from Bash func section in README (diff) | |
download | dotfiles-6f36a9e6494c723b209b253dfe3c83b62741c105.tar.gz dotfiles-6f36a9e6494c723b209b253dfe3c83b62741c105.zip |
Correctly bail from failed subshell
Diffstat (limited to 'sh/shrc.d/cd.sh')
-rw-r--r-- | sh/shrc.d/cd.sh | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sh/shrc.d/cd.sh b/sh/shrc.d/cd.sh index 37574f78..7bfacd6d 100644 --- a/sh/shrc.d/cd.sh +++ b/sh/shrc.d/cd.sh @@ -65,10 +65,10 @@ cd() { # Print the target printf '%s\n' "$new" + )" - # If the subshell failed, return from the function with the same exit - # value - )" || return + # If the subshell printed nothing, return with failure + [ -n "$2" ] || return fi # Execute the cd command as normal |