From 6f36a9e6494c723b209b253dfe3c83b62741c105 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 20 Aug 2016 13:45:17 +1200 Subject: Correctly bail from failed subshell --- sh/shrc.d/ud.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sh/shrc.d/ud.sh') diff --git a/sh/shrc.d/ud.sh b/sh/shrc.d/ud.sh index 0dfd858c..259f3167 100644 --- a/sh/shrc.d/ud.sh +++ b/sh/shrc.d/ud.sh @@ -32,10 +32,10 @@ ud() { # Print the target printf '%s\n' "$dirname" + )" - # If the subshell failed, return from the function with the same exit - # value - )" || return + # If the subshell printed nothing, return with failure + [ -n "$1" ] || return # Try to change into the determined directory command cd -- "$@" -- cgit v1.2.3