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

Re: default editor

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Feb 7, 2021, 19:09 UTC
Message-ID
<YCA64/coa/J5mBCl@camp.crustytoothpaste.net>
In-Reply-To
<YCAzcs1e08Qnk2wa@coredump.intra.peff.net>
On 2021-02-07 at 18:37:38, Jeff King wrote:
Show 17 quoted lines
> There are lots of ways to make ed exit non-zero. Any invalid command
> during the session will do. E.g.:
> 
>        $ echo bar >foo
>        $ ed foo
>  ed -> 4
>  me -> l
>  ed -> bar$
>  me -> 2l
>  ed -> ?
>  me -> q
>        $ echo $?
>        1
> 
> The "2l" was bogus (there is no line 2). It seems likely that an
> interactive user might make at least one invalid command while editing.
> Some versions (like GNU ed) have a "-l" option to loosen the exit code.

I wasn't previously aware of this behavior, and it's not very helpful unless you're scripting, since humans inevitably make mistakes. ex seems to have a more forgiving behavior; maybe it's similar enough that it'd be a better choice?

-- 
brian m. carlson (he/him or they/them)
Houston, Texas, US
Previous: Jeff KingNext: Eric Sunshine
Message 5 of 9 in “default editor”
  1. M Douglas McIlroyFeb 7, 2021
  2. brian m. carlsonFeb 7, 2021
  3. Junio C HamanoFeb 7, 2021
  4. Jeff KingFeb 7, 2021
  5. brian m. carlsonFeb 7, 2021
  6. Eric SunshineFeb 7, 2021
  7. Adam DinwoodieFeb 8, 2021
  8. M Douglas McIlroyFeb 11, 2021
  9. Eric SunshineFeb 12, 2021

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.