diff options
author | Mathew Inwood <mathewi@google.com> | 2018-09-14 15:19:10 +0100 |
---|---|---|
committer | Mathew Inwood <mathewi@google.com> | 2018-09-14 15:29:35 +0100 |
commit | 6be0fdde4adc0c41fb9bc3376e7d1938a5d4de25 (patch) | |
tree | acbc46e75c3bb287df6800b765990c6440f5b769 | |
parent | 53f6d1b060c10121062c4054514c3e3a0c2444bd (diff) |
Don't fail if there are no comments.
Grep exits with non-zero if it find no matches. But it doesn't matter in
this case, so just carry on.
Test: frameworks/base/tools/hiddenapi/sort_api.sh \
Test: frameworks/base/config/hiddenapi-light-greylist.txt
Change-Id: I7c219ee617f7dfa3cff5232ab979cc4ba38ebbfd
-rwxr-xr-x | tools/hiddenapi/sort_api.sh | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/hiddenapi/sort_api.sh b/tools/hiddenapi/sort_api.sh index bdcc8076dde1..76a2f2d6eba1 100755 --- a/tools/hiddenapi/sort_api.sh +++ b/tools/hiddenapi/sort_api.sh @@ -12,8 +12,8 @@ readarray A < "$source_list" # Sort IFS=$'\n' # Stash away comments -C=( $(grep -E '^#' <<< "${A[*]}") ) -A=( $(grep -v -E '^#' <<< "${A[*]}") ) +C=( $(grep -E '^#' <<< "${A[*]}" || :) ) +A=( $(grep -v -E '^#' <<< "${A[*]}" || :) ) # Sort entries A=( $(LC_COLLATE=C sort -f <<< "${A[*]}") ) A=( $(uniq <<< "${A[*]}") ) |