From 5194d4ad66ad130cb730e0b192ba1e2b5181184d Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Thu, 11 Jul 2019 12:22:31 -0700 Subject: grep: add -R as well as -r. On BSD these are actually the same, and there's a -S that you need in addition. So strictly this is a behavior change for Android (which is going from BSD grep to toybox grep), but it's a behavior preserving change for the AOSP build (which is going from GNU grep to toybox grep), and the latter actually has a checked-in use of -R where the former doesn't. --- tests/grep.test | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests') diff --git a/tests/grep.test b/tests/grep.test index dee59924..68c8dd85 100755 --- a/tests/grep.test +++ b/tests/grep.test @@ -175,3 +175,12 @@ mkdir sub/no echo "hello world" > sub/no/test testing "--exclude-dir" 'grep --exclude-dir=no -r world sub' "sub/yes/test:hello world\n" "" "" rm -rf sub + +# -r and -R differ in that -R will dereference symlinks to directories. +mkdir dir +echo "hello" > dir/f +mkdir sub +ln -s ../dir sub/link +testing "" "grep -rh hello sub" "" "" "" +testing "" "grep -Rh hello sub" "hello\n" "" "" +rm -rf sub real -- cgit v1.2.3