Re: less prints superfluous characters with --no-init
Jason McIntyre wrote: > On Wed, Nov 23, 2022 at 11:31:57PM +1059, Reuben mac Saoidhea wrote: > > i hate to harp on about it, but: > > > > in case you happen to discover the `command' command, > > beware that its description in sh(1) is wrong. > > > > sh(1) says: > > command -vV command args ... > > > > actually openbsd's sh(1) pages says: > > command [-p | -V | -v] command [arg ...] > > > in fact it is: > > command -vV command ... > > > > yes, -v and -V are different. instead of invoking command, they identify > information about "command", such as path used to run it. > > so we could do like posix and show two differing forms: > > command [-p] command_name [argument] > command [-p][-v|-V] command_name > > however one of the goals of sh(1) was brevity. to that end it is > combined, and i think it is obvious that if you are asking "command" to > identify whether something is a function (or whatever) then it would be > silly to specify it with arguments. Correct. Manual page SYNOPSIS are not a formal exact grammar. To provide another example, SYNOPSIS ls [-1AaCcdFfgHhikLlmnopqRrSsTtux] [file ...] I suspect there are mixtures ls arguments which create highly unexpected results, or even terminate the ls command before outputting an unexpected result. That is fine. We document the wider end of the possibility spectrum, not the narrow. All of us are sick of this thread. It contains no solutions. I'm now going to say that a solution for one manual pages, must provide diffs for *all the commands in bin* as a starting proposal.. That won't happen, so let's just stop it.
Re: less prints superfluous characters with --no-init
On Wed, Nov 23, 2022 at 11:31:57PM +1059, Reuben mac Saoidhea wrote: > i hate to harp on about it, but: > > in case you happen to discover the `command' command, > beware that its description in sh(1) is wrong. > > sh(1) says: > command -vV command args ... > actually openbsd's sh(1) pages says: command [-p | -V | -v] command [arg ...] > in fact it is: > command -vV command ... > yes, -v and -V are different. instead of invoking command, they identify information about "command", such as path used to run it. so we could do like posix and show two differing forms: command [-p] command_name [argument] command [-p][-v|-V] command_name however one of the goals of sh(1) was brevity. to that end it is combined, and i think it is obvious that if you are asking "command" to identify whether something is a function (or whatever) then it would be silly to specify it with arguments. > note in particular, that, like `type', > command -V command echo > > outputs > command is a shell builtin > echo is a shell builtin well, posix makes no claim that multiple arguments are supported with either -v or -V. openbsd's sh(1) page does not say this either. you could write some code to improve how this is handled, i suppose. having said that, ksh(1) seems to contradict what i've just said: If the -v option is given, instead of executing cmd, information about what would be executed is given (and the same is done for arg ...). that doesn;t seem to be the case. i'm not sure whether ksh(1) is wrong or it's expected to behave differently. > > rather than what `command -V' ought to output: > command echo is /bin/echo > $ command -V echo echo is a shell builtin jmc > to find out what `command blahcommand' means to sh(1), use > whereis blahcommand > > to find out what `blahcommand' means to sh(1), use > type blahcommand > > noting that `type' is explained in `man sh', > and that `tracked alias' means `hash'. > (note that using `type' affects `hash'.) > > isnt *N*X FUN!? >
Re: UNIX manual volume 2 (Supplementary Documents) Re: less prints superfluous characters with --no-init
On Mon, 2022-11-21 at 19:13 +1100, Reuben mac Saoidhea wrote: > > [heres if(3p) for some reason.] > > the fact that `man if' goes to a whole man page about a perl thing > rather than just the sh(1) page, is a bit silly i think. But you can see that `if` is documented in the 3p category which *is* for Perl. If there was an if(1) manual page it would have been selected first, otherwise you could just force man 1 each time. -- David
Re: less prints superfluous characters with --no-init
> to find out what `command blahcommand' means to sh(1), use > whereis blahcommand nope, thats wrong if `type blahcommand' says `builtin'. > pdksh i should have said `the korn shell', as ksh93 is just as bad.
Re: less prints superfluous characters with --no-init
> rather than what `command -V' ought to output: > command echo is /bin/echo if you look at command(1) after `pkg_add man-pages-posix', you will see POSIX is largely to blame for this oversight. some suggested advertising slogans for pdksh: ``hundreds of features--each buggier than the last!'' ``so many commands--you would be crazy to document them!'' ``now with less control flow!''
Re: less prints superfluous characters with --no-init
i hate to harp on about it, but: in case you happen to discover the `command' command, beware that its description in sh(1) is wrong. sh(1) says: command -vV command args ... in fact it is: command -vV command ... note in particular, that, like `type', command -V command echo outputs command is a shell builtin echo is a shell builtin rather than what `command -V' ought to output: command echo is /bin/echo to find out what `command blahcommand' means to sh(1), use whereis blahcommand to find out what `blahcommand' means to sh(1), use type blahcommand noting that `type' is explained in `man sh', and that `tracked alias' means `hash'. (note that using `type' affects `hash'.) isnt *N*X FUN!?
Re: less prints superfluous characters with --no-init
On Mon, Nov 21, 2022 at 08:51:36AM +0100, Jan Stary wrote: > On Nov 21 01:38:41, rto...@ceti.pl wrote: > > I guess it would not be very hard to just add few more *roff hacks > > Stop right here. My horses froze hanging in the air... :-) -- Regards, Tomasz Rola -- ** A C programmer asked whether computer had Buddha's nature. ** ** As the answer, master did "rm -rif" on the programmer's home** ** directory. And then the C programmer became enlightened... ** ** ** ** Tomasz Rola mailto:tomasz_r...@bigfoot.com **
Re: UNIX manual volume 2 (Supplementary Documents) Re: less prints superfluous characters with --no-init
> [heres if(3p) for some reason.] the fact that `man if' goes to a whole man page about a perl thing rather than just the sh(1) page, is a bit silly i think. i mean, perl isnt the default shell. why does perl `if' get its own man page, whereas the following are missing: * `man type' for `man sh' * volume 2, supplementary documents, for example: - UNIX tutorials and references - C reference - vi reference and tutorial * all the text, HTML, PDF docs that man can neither find nor show * all the docs and refs that never find their way out of various sources more to the point, how can anyone pretend OpenBSD has a great manual? its far better than ??apple sure, but it aint BSD UNIX good. im grateful for OpenBSD sure, but not for the FUD aimed at the weenies. > [% command] csh(1) would be bells and whistles. how about the default sh(1)? > [ssh command] you would type `ssh blah sshcommand'. the `command' is `ssh'. whereas i can use the `type' command without ever typing `sh'. > [@outlook.com] yeah, i should have run OpenSMTPD with its morris-worm era bug.
Re: less prints superfluous characters with --no-init
On Nov 21 01:38:41, rto...@ceti.pl wrote: > I guess it would not be very hard to just add few more *roff hacks Stop right here.
Re: less prints superfluous characters with --no-init
Jason McIntyre wrote (2022-11-20 21:45 CET): > On Sun, Nov 20, 2022 at 08:09:13PM +0100, Tomasz Rola wrote: > > On Sun, Nov 20, 2022 at 01:32:54PM -, Christian Weisgerber wrote: > > > On 2022-11-20, Reuben mac Saoidhea wrote: > > > > > > >> It is a builtin, so it is documented inside ksh. > > > > > > > > i think the 4.3BSD manual allowed for example `man while' for `man sh'? > > > > > > FreeBSD has a builtin(1) man page that attempts to list the csh(1) > > > and sh(1) builtins and points to the respective man pages: > > > > > > https://www.freebsd.org/cgi/man.cgi?query=builtin > > > > > > It's an attempt to do something about this problem, but I think the > > > result isn't that great. > > > > I am writing this from ParrotOS (Debian derivative) and since I am > > avid user of bash, I can do "man bash-builtins" and it prints me a > > very nice looking summary. Bash package version is 5.1-2+deb11u1, > > which probably means 5.1 with some Debian-specific addons. > > > > the thing is, you have to be aware of a builtins page in order to know > to type "man builtins" (or whatever). you would need to know that a > command is a builtin. but if you know it's a builtin, then you can just > type "man ksh" and get the documentation. > > we could add all these commands to ksh's NAME, but that would look awful. > > i think it's just a case of we should expect people to familiarise > themselves with the shell they're using, and know to go digging there. > openbsd does not generally have undocumented commands, so it's all there > somewhere. There are 4 things you can type into a shell: - executables (found along the path) - functions (defined by yourself [or the distribution]) - aliases (defined by yourself [or the distribution]) - builtins (comes with the shell) $ type type echo printf dgrep music_ambient ls type is a shell builtin echo is a shell builtin printf is /usr/bin/printf dgrep is a function music_ambient is an alias for 'mpg123 http://62.210.114.63:8002/listen.mp3' ls is a tracked alias for /bin/ls I think this is better than a manpage. If we provide two manpages, one for the builtin echo and one for /bin/echo, then you still don't know which one is actually used. bash: $ type printf printf is a shell builtin ksh: $ type printf printf is /usr/bin/printf Best Regards, Stefan
Re: UNIX manual volume 2 (Supplementary Documents) Re: less prints superfluous characters with --no-init
Reuben mac Saoidhea wrote: > > [what about ssh?] > > man(1) should document commands you might from the shell. Oh, so man(1) should cover *ANY* shell thing. # man if if(3p) Perl Programmers Reference Guide if(3p) NAME if - "use" a Perl module if a condition holds % man set man: No entry for set in the manual. % man while man: No entry for while in the manual. Bye bye circularargume...@outlook.com
UNIX manual volume 2 (Supplementary Documents) Re: less prints superfluous characters with --no-init
> am i being punished in the same way as you??? its not me thats being punished... i would encourage UNIX newbies to read volume 2 of the V7 man https://s3.amazonaws.com/plan9-bell-labs/7thEdMan/index.html it has the tutorials and references and all that good stuff. it lacks the BSD stuff found in the BSD Supplementary Documents, notably vi(1) and ex(1). these can be got from: https://sites.google.com/a/bostic.com/keithbostic/files/nvi-1.79.tar.gz docs/USD.doc/vitut/vitut.ps vi intro (use ps2pdf) docs/USD.doc/vi.ref/vi.ref.txt vi ref (use less) docs/USD.doc/exref/exref.ps ex ref (ps2pdf) docs/USD.doc/vi.man/vi.0what OpenBSD has `ps2pdf' can be got with `pkg_add ghostscript' if you want to use the Makefile, try `pkg_add heirloom-doctools groff'. > [what about ssh?] man(1) should document commands you might from the shell. > [ksh!] like i said, ksh(1) features tend to be buggy. i stick to sh(1).
Re: less prints superfluous characters with --no-init
Forgive me, I don't spend my life using ksh esoterica But I do use ssh all the time man AddKeysToAgent man AddressFamily man BatchMode man BindAddress man CanonicalDomains man CanonicalizeFallbackLocal man CanonicalizeHostname man CanonicalizeMaxDots man CanonicalizePermittedCNAMEs man CASignatureAlgorithms man CertificateFile man CheckHostIP man Ciphers man ClearAllForwardings man Compression man ConnectionAttempts man ConnectTimeout man ControlMaster man ControlPath man ControlPersist man DynamicForward man EscapeChar man ExitOnForwardFailure man FingerprintHash man ForkAfterAuthentication man ForwardAgent man ForwardX11 man ForwardX11Timeout man ForwardX11Trusted man GatewayPorts man GlobalKnownHostsFile man GSSAPIAuthentication man GSSAPIDelegateCredentials man HashKnownHosts man Host man HostbasedAcceptedAlgorithms man HostbasedAuthentication man HostKeyAlgorithms man HostKeyAlias man Hostname man IdentitiesOnly man IdentityAgent man IdentityFile man IPQoS man KbdInteractiveAuthentication man KbdInteractiveDevices man KexAlgorithms man KnownHostsCommand man LocalCommand man LocalForward man LogLevel man MACs man Match man NoHostAuthenticationForLocalhost man NumberOfPasswordPrompts man PasswordAuthentication man PermitLocalCommand man PermitRemoteOpen man PKCS11Provider man Port man PreferredAuthentications man ProxyCommand man ProxyJump man ProxyUseFdpass man PubkeyAcceptedAlgorithms man PubkeyAuthentication man RekeyLimit man RemoteCommand man RemoteForward man RequestTTY man RequiredRSASize man SendEnv man ServerAliveInterval man ServerAliveCountMax man SessionType man SetEnv man StdinNull man StreamLocalBindMask man StreamLocalBindUnlink man StrictHostKeyChecking man TCPKeepAlive man Tunnel man TunnelDevice man UpdateHostKeys man User man UserKnownHostsFile man VerifyHostKeyDNS man VisualHostKey man XAuthLocation those are ssh builtins there is no manual page. am i being punished in the same way as you??? No, I am not. When you are using ksh, you can read the ksh manual page. You cannot assume the commands you type in are entirely ksh, in the $PATH, but you can use your brain and suspect that some of them are builtins, and check the damn man page for ksh. Whan I am in ssh, I can do the same. What should we do to settle this outrage? We could do is take every word found in the ksh manual page, and make it a keyword the man command will find. man if -> obviously ksh man while -> obviously ksh man the -> obviously ksh, also Obviously there is a cluster of people who will be satisfied until we do that. Reuben mac Saoidhea wrote: > i feel i ought to repeat myself: you really ought to use: > > type [command ...] > > some problems with the manual: > > * you have to type `man sh'. you cant type `man type'. > * sh(1) does not explain that `tracked alias' in the output of > `type' relates to the output of `hash'. see `hash' in sh(1). > > some problems with the other commands: > > * some are not a part of the shell. they cant tell you about shell stuff. > * some just echo back function names, etc. > * some are ksh(1) features. ksh(1) features are often buggy, etc. >
Re: less prints superfluous characters with --no-init
i feel i ought to repeat myself: you really ought to use: type [command ...] some problems with the manual: * you have to type `man sh'. you cant type `man type'. * sh(1) does not explain that `tracked alias' in the output of `type' relates to the output of `hash'. see `hash' in sh(1). some problems with the other commands: * some are not a part of the shell. they cant tell you about shell stuff. * some just echo back function names, etc. * some are ksh(1) features. ksh(1) features are often buggy, etc.
Re: less prints superfluous characters with --no-init
On Mon, Nov 21, 2022 at 01:38:41AM +0100, Tomasz Rola wrote: [...] > I guess it would not be very hard to just add few more *roff hacks > similar to one above. Or maybe a command (shell script) to retrieve > relevant subsection from manpage and print just this one. And maybe > also list names of subsections available on the page. It seems that > '^[A-Z]( |[A-Z])+$' is the name regexp... So... Forgot to mention that woman mode in emacs gives exactly this - jumping to sections and some more. -- Regards, Tomasz Rola -- ** A C programmer asked whether computer had Buddha's nature. ** ** As the answer, master did "rm -rif" on the programmer's home** ** directory. And then the C programmer became enlightened... ** ** ** ** Tomasz Rola mailto:tomasz_r...@bigfoot.com **
Re: less prints superfluous characters with --no-init
On Sun, Nov 20, 2022 at 08:45:01PM +, Jason McIntyre wrote: > On Sun, Nov 20, 2022 at 08:09:13PM +0100, Tomasz Rola wrote: [...] > > I am writing this from ParrotOS (Debian derivative) and since I am > > avid user of bash, I can do "man bash-builtins" and it prints me a > > very nice looking summary. Bash package version is 5.1-2+deb11u1, > > which probably means 5.1 with some Debian-specific addons. > > > > the thing is, you have to be aware of a builtins page in order to know > to type "man builtins" (or whatever). you would need to know that a > command is a builtin. but if you know it's a builtin, then you can just > type "man ksh" and get the documentation. Sure. As a matter of fact, I was for years grumbling about how long bash manpage is and how long it takes to locate relevant info. Today I have learned to look for "builtin(|s)" with apropos and here it is. I have dug a bit deeper and "zcat /usr/share/man/man7/bash-builtins.7.gz" shows me that it is just a *roff hack to display subsection of bash manpage. Worth remembering. > we could add all these commands to ksh's NAME, but that would look awful. I guess it would not be very hard to just add few more *roff hacks similar to one above. Or maybe a command (shell script) to retrieve relevant subsection from manpage and print just this one. And maybe also list names of subsections available on the page. It seems that '^[A-Z]( |[A-Z])+$' is the name regexp... So... $ man bash | grep -iE '^[A-Z]( |[A-Z])+$' NAME SYNOPSIS COPYRIGHT DESCRIPTION ... SHELL BUILTIN COMMANDS ... and so on. -- Regards, Tomasz Rola -- ** A C programmer asked whether computer had Buddha's nature. ** ** As the answer, master did "rm -rif" on the programmer's home** ** directory. And then the C programmer became enlightened... ** ** ** ** Tomasz Rola mailto:tomasz_r...@bigfoot.com **
Re: less prints superfluous characters with --no-init
On Sun, Nov 20, 2022 at 08:09:13PM +0100, Tomasz Rola wrote: > On Sun, Nov 20, 2022 at 01:32:54PM -, Christian Weisgerber wrote: > > On 2022-11-20, Reuben mac Saoidhea wrote: > > > > >> It is a builtin, so it is documented inside ksh. > > > > > > i think the 4.3BSD manual allowed for example `man while' for `man sh'? > > > > FreeBSD has a builtin(1) man page that attempts to list the csh(1) > > and sh(1) builtins and points to the respective man pages: > > > > https://www.freebsd.org/cgi/man.cgi?query=builtin > > > > It's an attempt to do something about this problem, but I think the > > result isn't that great. > > I am writing this from ParrotOS (Debian derivative) and since I am > avid user of bash, I can do "man bash-builtins" and it prints me a > very nice looking summary. Bash package version is 5.1-2+deb11u1, > which probably means 5.1 with some Debian-specific addons. > the thing is, you have to be aware of a builtins page in order to know to type "man builtins" (or whatever). you would need to know that a command is a builtin. but if you know it's a builtin, then you can just type "man ksh" and get the documentation. we could add all these commands to ksh's NAME, but that would look awful. i think it's just a case of we should expect people to familiarise themselves with the shell they're using, and know to go digging there. openbsd does not generally have undocumented commands, so it's all there somewhere. jmc
Re: less prints superfluous characters with --no-init
On Sun, Nov 20, 2022 at 01:32:54PM -, Christian Weisgerber wrote: > On 2022-11-20, Reuben mac Saoidhea wrote: > > >> It is a builtin, so it is documented inside ksh. > > > > i think the 4.3BSD manual allowed for example `man while' for `man sh'? > > FreeBSD has a builtin(1) man page that attempts to list the csh(1) > and sh(1) builtins and points to the respective man pages: > > https://www.freebsd.org/cgi/man.cgi?query=builtin > > It's an attempt to do something about this problem, but I think the > result isn't that great. I am writing this from ParrotOS (Debian derivative) and since I am avid user of bash, I can do "man bash-builtins" and it prints me a very nice looking summary. Bash package version is 5.1-2+deb11u1, which probably means 5.1 with some Debian-specific addons. -- Regards, Tomasz Rola -- ** A C programmer asked whether computer had Buddha's nature. ** ** As the answer, master did "rm -rif" on the programmer's home** ** directory. And then the C programmer became enlightened... ** ** ** ** Tomasz Rola mailto:tomasz_r...@bigfoot.com **
Re: less prints superfluous characters with --no-init
indivC wrote (2022-11-19 16:13 CET): > I can't say I understand the technical differences > between 'type' and which(1). > However, I will mention these points: > > 1. There is no man page for 'type', but there is for which(1) try ksh(1): typeShort form of command -V There is also whence. > 2. There also appears to be whereis(1). However, I can't speak > to the differences between this command and the other two. As described the respective manpages: whereis searches in /usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin which searches in $PATH Best Regards, Stefan
Re: less prints superfluous characters with --no-init
Reuben mac Saoidhea wrote: > > It is a builtin, so it is documented inside ksh. > > i think the 4.3BSD manual allowed for example `man while' for `man sh'? I rather doubt that, and this is not 4.3BSD
Re: less prints superfluous characters with --no-init
On 2022-11-20, Reuben mac Saoidhea wrote: >> It is a builtin, so it is documented inside ksh. > > i think the 4.3BSD manual allowed for example `man while' for `man sh'? FreeBSD has a builtin(1) man page that attempts to list the csh(1) and sh(1) builtins and points to the respective man pages: https://www.freebsd.org/cgi/man.cgi?query=builtin It's an attempt to do something about this problem, but I think the result isn't that great. -- Christian "naddy" Weisgerber na...@mips.inka.de
Re: less prints superfluous characters with --no-init
> It is a builtin, so it is documented inside ksh. i think the 4.3BSD manual allowed for example `man while' for `man sh'?
Re: less prints superfluous characters with --no-init
indivC wrote: > I can't say I understand the technical differences > between 'type' and which(1). > However, I will mention these points: > > 1. There is no man page for 'type', but there is for which(1) It is a builtin, so it is documented inside ksh.
Re: less prints superfluous characters with --no-init
I can't say I understand the technical differences between 'type' and which(1). However, I will mention these points: 1. There is no man page for 'type', but there is for which(1) 2. There also appears to be whereis(1). However, I can't speak to the differences between this command and the other two. --- Original Message --- On Saturday, November 19th, 2022 at 12:00 AM, Reuben mac Saoidhea wrote: > you really ought to use `type', not` which', > in case it is a shell function etc.
Re: less prints superfluous characters with --no-init
you really ought to use `type', not `which', in case it is a shell function etc.
Re: less prints superfluous characters with --no-init
"Richard Ulmer" wrote: > Hi all, > I find this behaviour unexpected: > > $ printf foo | less --no-init | xxd > : 666f 6f1b 5b41 1b5b 4b foo.[A.[K > > less prints ANSI escape codes for 'cursor up' and 'erase in line' at the > end of my message. Interestingly, when doing the same within tmux, the > result is different: > > $ printf foo | less --no-init | xxd > : 666f 6f1b 4d1b 5b4b foo.M.[K > > Is this intended behaviour? If so, is there any flag to disable this? > > Greetings, > Richard Another user mentioned, that he couldn't reproduce the problem, which made me check 'which less'. I found that I wasn't using /usr/bin/less, but a script around it, which I forgot about. The script caused the problem. Sorry for the unnecessary mail. Richard
Re: less prints superfluous characters with --no-init
"Richard Ulmer": > I find this behaviour unexpected: > > $ printf foo | less --no-init | xxd > : 666f 6f1b 5b41 1b5b 4b foo.[A.[K > > less prints ANSI escape codes for 'cursor up' and 'erase in line' at the > end of my message. I cannot reproduce this. $ printf foo | less --no-init | hexdump -C 66 6f 6f |foo| 0003 -- Christian "naddy" Weisgerber na...@mips.inka.de
less prints superfluous characters with --no-init
Hi all, I find this behaviour unexpected: $ printf foo | less --no-init | xxd : 666f 6f1b 5b41 1b5b 4b foo.[A.[K less prints ANSI escape codes for 'cursor up' and 'erase in line' at the end of my message. Interestingly, when doing the same within tmux, the result is different: $ printf foo | less --no-init | xxd : 666f 6f1b 4d1b 5b4b foo.M.[K Is this intended behaviour? If so, is there any flag to disable this? Greetings, Richard