projects
/
platform
/
upstream
/
btrfs-progs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ffb2878
)
btrfs-progs: tests: fix _is_file_or_command detection
author
David Sterba
<dsterba@suse.com>
Fri, 25 Aug 2017 13:44:24 +0000
(15:44 +0200)
committer
David Sterba
<dsterba@suse.com>
Fri, 25 Aug 2017 13:58:05 +0000
(15:58 +0200)
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>
tests/common
patch
|
blob
|
history
diff --git
a/tests/common
b/tests/common
index
a1ab3e0
..
d0324a6
100644
(file)
--- 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