Bug 229472 - man echo misses -e option
Summary: man echo misses -e option
Status: Closed Works As Intended
Alias: None
Product: Documentation
Classification: Unclassified
Component: Manual Pages (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-02 09:47 UTC by Torsten Zuehlsdorff
Modified: 2019-01-23 10:39 UTC (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Torsten Zuehlsdorff freebsd_committer freebsd_triage 2018-07-02 09:47:51 UTC
Aloha,

man echo does not document the "-e" option.

This option will for example convert an "\n" into a real new line. Example: 

$ echo "muff\nmuff"
muff\nmuff
$ echo -e "muff\nmuff"
muff
muff

This works for other control chars too.

I stumbled across this by accident.

Greetings,
Torsten
Comment 1 Benedict Reuschling freebsd_committer freebsd_triage 2018-07-02 09:55:38 UTC
That would make a good EXAMPLES section entry, too.
Comment 2 Rodrigo Osorio freebsd_committer freebsd_triage 2018-07-02 10:21:33 UTC
I think 'echo' man page tends to be as generic as possible and you should refer the shell manpage itself for additional options. AFAIK the "-e" option isn't supported by csh.

The 'sh' manpage provide the information you want :

echo [-e | -n] [string ...]
  -e      Process C-style backslash escape sequences.  The echo ....
Comment 3 Jamie Landeg-Jones 2018-07-02 10:54:23 UTC
Assuming echo(1) refers to /bin/echo - it doesn't support "-e" which is something only the builtin internal "echo" under "sh" supports, and hence it's therefore only documented in the 'sh' manpage, as Rodrigo says.

tcsh builtin "echo" supports the same functionality, but by setting the "echo_style" variable as appropriate, rather than using '-e'.
Comment 4 Conrad Meyer freebsd_committer freebsd_triage 2018-07-02 17:48:02 UTC
Jamie hits the nail on the head.  And I guess we're already explicit about this:

     Most shells provide a builtin echo command which tends to differ from
     this utility in the treatment of options and backslashes.  Consult the
     builtin(1) manual page.

Although it is buried at the bottom of the DESCRIPTION section.

Maybe that could be highlighted in its own section (IMPLEMENTATION NOTES?) instead.
Comment 5 Torsten Zuehlsdorff freebsd_committer freebsd_triage 2018-07-03 07:42:22 UTC
(In reply to Conrad Meyer from comment #4)

> Jamie hits the nail on the head.  And I guess we're already explicit 
> about this:

I tend to disagree ;)

When using "man alias" for example, we get the builtin manpage. This is true for every builtin i every tried the last years. "man echo" is the only manpage for an builtin.

Also the statement is not too helpful. While i am able to figure out which shell i am using: many users are not. Also the builtin manpage itself is not very helpful. It redirects me to the next manpage of the shell itself (after g. 

So my workflow is:
1) man echo 
2) man builtin
3) man bash

And every manpage is getting more complex and harder to understand. Beside the fact, that its possible to use different echos (if i read the buildin manpage correct?).

In conclusion: maybe its fine from a technical point of view. From a user point of view it is very confusing.
Comment 6 Benjamin Kaduk freebsd_committer freebsd_triage 2018-07-04 04:16:22 UTC
(In reply to Torsten Zuehlsdorff from comment #5)

Well, most builtins don't have corresponding standalone binaries (to large extent because they need to modify the state of the running shell).
But, kill(1) has a manpage as a standalone utility, as does login(1), time(1), etc.

I do use basically the same workflow (though I tend to use sh.1 instead of bash.1), but I'm not sure there's a great option here that maintains the technical accuracy.
Comment 7 Torsten Zuehlsdorff freebsd_committer freebsd_triage 2019-01-23 10:39:59 UTC
While i'm not happy with the current state i failed to image a better solution. Therefore i will close the issue.