From fb0d53a9377351d2875bde422e11b1213caf0b48 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Fri, 25 Aug 2017 15:44:24 +0200 Subject: btrfs-progs: tests: fix _is_file_or_command detection type -p returns an empty string for nonexistent commands, but the -f test on an empty string does not behave the same on all shells. To be safe, use the quoted value. Signed-off-by: David Sterba --- tests/common | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests/common') diff --git a/tests/common b/tests/common index a1ab3e03..d0324a62 100644 --- a/tests/common +++ b/tests/common @@ -35,7 +35,8 @@ _is_file_or_command() if [ -f "$msg" -o -d "$msg" -o -b "$msg" ]; then return 0 fi - if [ -f $(type -p "$msg") ]; then + msg=$(type -p "$msg") + if [ -f "$msg" ]; then return 0 fi return 1 -- cgit v1.2.3