diff --git a/CHANGELOG.md b/CHANGELOG.md index 50e4ec9..fcd8fc6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ folgen [Semantic Versioning](https://semver.org/lang/de/). Die Version steht in ## [Unveröffentlicht] +### Geändert +- README und `man/row.man` erklären, warum `select` in bash/zsh/ksh einen Syntaxfehler gibt und wie man es trotzdem aufruft. + +### Behoben +- `rdb man` zeigte `\\select` in den Man-Pages als `\elect`: ein doppelter Backslash wird jetzt zuerst geschützt. + ## [0.5.0] - 2026-10-11 ### Hinzugefügt diff --git a/README.md b/README.md index 5416364..d720940 100644 --- a/README.md +++ b/README.md @@ -175,6 +175,10 @@ er nicht mehr passt (außer mit `-a`). Beide halten die Indizes aktuell. `row`, `compute`, `column`, `sorttable`, `jointable`, `rename`, `validate` und `rdb` haben dazu den Abschnitt „Case of Column Names“; er ist die einzige Ergänzung gegenüber den Original-Seiten. +- `select` ist in bash, zsh und ksh ein reserviertes Wort. `select 'Cost > 5' < inventory` endet dort + mit `syntax error near unexpected token '<'`, weil die Shell das Schlüsselwort vor dem `PATH` auswertet. + Es gibt dasselbe unter dem Namen `row`. Außerdem gehen `\select ...`, `command select ...` und + `rdb select ...`. - `jointable` braucht keine vorsortierten Tabellen. - `ve` ist ein zeilenorientierter Editor, kein Bildschirmeditor. - `soundex` nutzt den Standard-Algorithmus. Die Beispielwerte im Handbuch diff --git a/lib/rdb/cmd/term.rb b/lib/rdb/cmd/term.rb index 3e7b737..8dd6f55 100644 --- a/lib/rdb/cmd/term.rb +++ b/lib/rdb/cmd/term.rb @@ -81,9 +81,10 @@ end # ---- manual pages --------------------------------------------------------------- def troff_clean(str) - str.gsub(/\\f[BIRP]/, '').gsub('\\e', '\\').gsub('\\(em', ' -- ').gsub('\\(aa', "'") + # a literal backslash (\\ or \e) is parked in \0 so that later rules cannot see it + str.gsub('\\\\', "\0").gsub(/\\f[BIRP]/, '').gsub('\\e', "\0").gsub('\\(em', ' -- ').gsub('\\(aa', "'") .gsub('\\-', '-').gsub('\\&', '').gsub('\\*(UX', 'UNIX').gsub('``', '"').gsub("''", '"').gsub('\\ ', ' ') - .gsub(/\\\(..|\\\*\(..|\\[a-z]/, '').gsub('\\\\', '\\') + .gsub(/\\\(..|\\\*\(..|\\[a-z]/, '').gsub("\0", '\\') end def render_man(src) diff --git a/man/row.man b/man/row.man index f37f1ad..d8bfbfe 100644 --- a/man/row.man +++ b/man/row.man @@ -191,6 +191,32 @@ Names that are also reserved words or are followed by .B ( are never taken for columns. +.SH "Using select in a Shell" +.I "(Ruby re-creation only.)" +.B select +is another name for +.BR row , +but in +.BR bash , +.B zsh +and +.B ksh +``select'' is a reserved word of the shell. +The shell recognizes it before it looks for a program, so +.DM +select 'Cost > 5' < inventory +.DE +.PP +stops with a syntax error at the ``<''. +Use the name +.B row +instead, or protect the word from the shell: +.DM +row 'Cost > 5' < inventory +\\select 'Cost > 5' < inventory +command select 'Cost > 5' < inventory +rdb select 'Cost > 5' < inventory +.DE .SH "See Also" .B compute,