Re: [PATCH 2/3] rebase-i: slight internal improvements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Fri, Jun 20, 2008 at 09:16:43AM +0200, Johannes Sixt wrote:
> If by "other slight improvements" you mean ...
> 
> >  mark_action_done () {
> > -	sed -e 1q < "$TODO" >> "$DONE"
> > -	sed -e 1d < "$TODO" >> "$TODO".new
> > -	mv -f "$TODO".new "$TODO"
> > -	count=$(grep -c '^[^#]' < "$DONE")
> > -	total=$(($count+$(grep -c '^[^#]' < "$TODO")))
> > +	sed -e 1q "$TODO" >>"$DONE"
> > +	sed -e 1d "$TODO" >>"$TODO.new"
> > +	mv -f "$TODO.new" "$TODO"
> > +	count="$(grep -c '^[^#]' "$DONE")"
> > +	total="$(expr "$count" + "$(grep -c '^[^#]' "$TODO")")"
> 
> ... this ...
> 
> >  has_action () {
> > -	grep '^[^#]' "$1" >/dev/null
> > +	grep -q '^[^#]' "$1"
> 
> ... and this, etc, then they are not improvements. They make the script
> less portable:

Ok, great to know.

> There are 'grep's that don't have -q,

Well, it's always a little hard to say what is understood by most of the
implementations.  POSIX says, there is grep -q and a few git test
scripts and the Makefile uses it, too.

Ok, so I've looked for a list "the least common denominator of shell
commands you can use to be portable" on the net and found the 
GNU Autoconf documentation:
http://www.gnu.org/software/autoconf/manual/autoconf-2.57/html_node/autoconf_123.html
Looks like *portable* shell programming is no fun :\

> others write the file name in front of the count,

I did not really change anything that's related to the count, btw.


Regards,
  Stephan

-- 
Stephan Beyer <s-beyer@xxxxxxx>, PGP 0x6EDDD207FCC5040F
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux