diff options
author | David Sterba <dsterba@suse.com> | 2017-08-25 15:44:24 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2017-08-25 15:58:05 +0200 |
commit | fb0d53a9377351d2875bde422e11b1213caf0b48 (patch) | |
tree | 3d9e125e62e7afa7b6cf184eb2553886e5052ea1 /tests/common | |
parent | ffb2878e1ee4620fc2e6e99f20841087bb717080 (diff) |
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>
Diffstat (limited to 'tests/common')
-rw-r--r-- | tests/common | 3 |
1 files changed, 2 insertions, 1 deletions
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 |