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 <dsterba@suse.com>
This commit is contained in:
David Sterba 2017-08-25 15:44:24 +02:00
parent ffb2878e1e
commit fb0d53a937

View File

@ -35,7 +35,8 @@ _is_file_or_command()
if [ -f "$msg" -o -d "$msg" -o -b "$msg" ]; then if [ -f "$msg" -o -d "$msg" -o -b "$msg" ]; then
return 0 return 0
fi fi
if [ -f $(type -p "$msg") ]; then msg=$(type -p "$msg")
if [ -f "$msg" ]; then
return 0 return 0
fi fi
return 1 return 1