From: Tom de Vries <Tom_deVries@mentor.com>
To: Andreas Schwab <schwab@suse.de>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>, Jeff Law <law@redhat.com>
Subject: Re: check_GNU_style.sh: Don't cat empty file
Date: Mon, 18 May 2015 09:01:00 -0000 [thread overview]
Message-ID: <5559A959.6040609@mentor.com> (raw)
In-Reply-To: <mvmzj52jnhu.fsf@hawking.suse.de>
On 18-05-15 10:31, Andreas Schwab wrote:
> Tom de Vries <Tom_deVries@mentor.com> writes:
>
>> diff --git a/contrib/check_GNU_style.sh b/contrib/check_GNU_style.sh
>> index 728c11a..ab59b1e 100755
>> --- a/contrib/check_GNU_style.sh
>> +++ b/contrib/check_GNU_style.sh
>> @@ -84,10 +84,16 @@ grep $format '^+' $files \
>> g (){
>> local msg="$1"
>> local arg="$2"
>> +
>> + local found=false
>> cat $inp \
>> | egrep --color=always -- "$arg" \
>> - > $tmp && printf "\n$msg\n"
>> - cat $tmp
>> + > "$tmp" && found=true
>> +
>> + if $found; then
>
> cat $inp \
> | egrep --color=always -- "$arg" \
> > $tmp && {
> printf "\n$msg\n"
> cat $tmp
> }
>
Hi Andreas,
yep, that's another and indeed shorter way to do the same.
I prefer the committed version though, with a variable name making explicit what
the '&&' situation means, and handling that situation in a separate statement.
Thanks,
- Tom
prev parent reply other threads:[~2015-05-18 8:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-18 7:31 Tom de Vries
2015-05-18 8:41 ` Andreas Schwab
2015-05-18 9:01 ` Tom de Vries [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5559A959.6040609@mentor.com \
--to=tom_devries@mentor.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=law@redhat.com \
--cc=schwab@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).