git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [COGITO PATCH] Optimized print_help()

From
Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Date
Jun 15, 2005, 18:58 UTC
Message-ID
<42B07A6F.3000001@lsrfire.ath.cx>
In-Reply-To
<1118795583.3890.27.camel@dv>
Pavel Roskin schrieb:
Show 11 quoted lines
>>> +	cat $toolpath | sed -n '3,/^$/s/^# *//p'
>> 
>> What about also removing UUOC from this line ...
> 
> 
> UUOC?  I had too look it up :-)
> 
> It's not just "useless use of cat", but also useless use of
> redirection in both cases.  I guess sed can exit after it finishes
> processing the range (I don't know if it actually does), so feeding
> it the whole file is not need.

It doesn't matter if the shell opens the file or if sed does it itself, sed's ability to close the file and quit when done doesn't depend on that. So this call is equivalent and has the advantage of being resistant against filenames starting with a "-":

   sed -n '3,/^$/s/^# *//p' <"$toolpath"
Rene
Previous: Pavel RoskinNext: Pavel Roskin
Message 4 of 5 in “Optimized print_help()”
  1. Optimized print_help()Pavel Roskin, Jun 14, 2005
  2. Jonas FonsecaJun 15, 2005
  3. Pavel RoskinJun 15, 2005
  4. Rene ScharfeJun 15, 2005
  5. Pavel RoskinJun 15, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.