diff options
author | Elliott Hughes <enh@google.com> | 2019-07-11 12:22:31 -0700 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2019-07-12 12:18:45 -0500 |
commit | 5194d4ad66ad130cb730e0b192ba1e2b5181184d (patch) | |
tree | e435db7dfed5b1503dc852bbf566852c61651e7f /tests | |
parent | dff94300f9bd0f3e6e33a22d480ea11380ddd039 (diff) | |
download | toybox-5194d4ad66ad130cb730e0b192ba1e2b5181184d.tar.gz |
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.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/grep.test | 9 |
1 files changed, 9 insertions, 0 deletions
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 |