use grep -q

This commit is contained in:
Thomas Levine 2016-03-29 16:57:21 +00:00
parent 2b4444dbed
commit 3e83e2cb30

14
urchin
View File

@ -70,7 +70,7 @@ validate_test_arg() {
root="$(urchin_root "${1}")" root="$(urchin_root "${1}")"
if ! { if ! {
basename "$(fullpath "${root}")" | basename "$(fullpath "${root}")" |
grep -i 'test' > /dev/null || "${force}" grep -qi 'test' || "${force}"
}; then }; then
echo 'The root directory of the tests that you are running urchin on echo 'The root directory of the tests that you are running urchin on
does not contain the word "test", so I am not running, does not contain the word "test", so I am not running,
@ -128,7 +128,7 @@ urchin_root() {
abscurrent="$(fullpath "${1}")" abscurrent="$(fullpath "${1}")"
if test "${abscurrent}" = / || if test "${abscurrent}" = / ||
basename "${abscurrent}" | grep '^\.' > /dev/null; then basename "${abscurrent}" | grep -q '^\.' ; then
# Stop traversing upwards at / and at hidden directories. # Stop traversing upwards at / and at hidden directories.
if test -d "${orig}"; then if test -d "${orig}"; then
echo "${orig}" echo "${orig}"
@ -169,8 +169,8 @@ recurse() {
fi fi
done done
if echo "${requested_path}" | grep "^${potential_test}" > /dev/null || if echo "${requested_path}" | grep -q "^${potential_test}" ||
echo "${potential_test}" | grep "^${requested_path}" > /dev/null; then echo "${potential_test}" | grep -q "^${requested_path}" ; then
if test "$(dirname "${potential_test}")" = \ if test "$(dirname "${potential_test}")" = \
"$(dirname "${requested_path}")" && "$(dirname "${requested_path}")" &&
test "${potential_test}" != "${requested_path}"; then test "${potential_test}" != "${requested_path}"; then
@ -186,7 +186,7 @@ recurse() {
if [ -d "${potential_test}" ]; then if [ -d "${potential_test}" ]; then
( (
cd -- "${potential_test}" cd -- "${potential_test}"
if test -f .urchin_dir && grep series .urchin_dir > /dev/null; then if test -f .urchin_dir && grep -q series .urchin_dir ; then
run_in_series_dir=true run_in_series_dir=true
else else
run_in_series_dir=false run_in_series_dir=false
@ -425,7 +425,7 @@ report_outcome() {
} }
has_shebang_line() { has_shebang_line() {
head -n 1 "${1}" | grep -v '#!/bin/sh' | grep -q '^#!' head -n 1 "${1}" | grep -q -v '#!/bin/sh' | grep -q '^#!'
} }
USAGE="usage: $0 [options]... [test file or directory]..." USAGE="usage: $0 [options]... [test file or directory]..."
@ -547,7 +547,7 @@ main() {
} }
validate_strings "${shell_for_sh_tests}" 'Shell paths' validate_strings "${shell_for_sh_tests}" 'Shell paths'
if echo "${shell_for_sh_tests}" | grep \ > /dev/null; then if echo "${shell_for_sh_tests}" | grep -q \ ; then
echo "Warning: It is best if shell paths contain no spaces so that echo "Warning: It is best if shell paths contain no spaces so that
you don't need to quote the TEST_SHELL variable." > /dev/stderr you don't need to quote the TEST_SHELL variable." > /dev/stderr
fi fi