But, in my opinion, that's where it should stop: one shouldn't use a shell language for scripting. In scripts, it is simpler to use more verbose and clear constructs, because most editors are very powerful and provide shortcuts themselves.
But, in my opinion, that's where it should stop: one shouldn't use a shell language for scripting. In scripts, it is simpler to use more verbose and clear constructs, because most editors are very powerful and provide shortcuts themselves.
>man bash
/\$\( # search pattern needs escaping
...
value is evaluated as an arithmetic expression even if the $((...)) expansion is not used (see Arithmetic Expansion below). Word split‐
...
n # go to next match
Command Substitution
Command substitution allows the output of a command to replace the command name. There are two forms:
$(command)
or
`command`
(detailed description follows)
I'm still in favor of using more verbose and especially more clear constructs, but not because they are easier for Google, but because they ideally hold enough information on their own that you don't even need to look it up to know what it does. type man foo
type /-p
type n n n n n n n n n
as there are a bunch of matches like “...does bar when combined with -p...”A presentation of man pages that used hypertext would make me a lot happier.
If you’re using mandoc (http://mandoc.bsd.lv/) as your man(1) program—the default on OpenBSD and a couple of Linuxes like Void and Alpine—it will use these semantics to generate hyperlinks in the terminal using more(1) and less(1)’s ctags support.
So on my machine, your example becomes:
type man foo
type :t
type p
This brings me to the first instance of a command‐line flag named “-p” or environment variable named “p” in an itemized list.It translates to HTML too—check out the links generated by the web viewer, which uses the same backend. https://man.openbsd.org/ls.1
info is a greatly underused system and I'd recommend any *nix users to spend some time learning how to navigate it.
From some other comments, it sounds like "info" uses emacs at its core? So I suppose I'd have to learn some emacs commands, if that's the case.
I'm surprised indexes aren't working for you - unfortunately I don't know of any suggestions to fix that.
This thread is a good reminder to give it another go.
[1] https://www.gnu.org/software/bash/manual/html_node/index.htm...
Kind of a deep rabbit hole, isn't it?
/ -p $ apropos timezone
Date::Manip::DM5abbrevs (3pm) - A list of all timezone abbreviations
dm_zdump (1p) - timezone dumper
Time::Zone (3pm) - - miscellaneous timezone manipulations routines
timezone (3) - initialize time conversion information
tzfile (5) - timezone information
tzselect (1) - view timezones
tzselect (8) - select a timezone
zdump (8) - timezone dumper
zic (8) - timezone compiler
Can even search using regular expressions. man man
man less
Not a joke. Learn the simple tools that help you daily.What helps me somehow is the fact that definitions in man pages are usually start on a new line and are indented by several spaces.
man bash
/ -o
This finds an inline mention, not very useful. man bash
/^ +-o
This finds the definition: start of line, then some space, then the -o.It has been my experience that the definition of switches, unlike their use in examples or other text, occurs as the first thing on the line, so my search expression would be:
/^ *-p
(you likely can't see it, but there is a trailing space, too, to ensure it's just that flag, and not "-parallel" or whatever)It's possible the text will be tab-indented, in which case:
/^[ ^I]*-p[ ^I]
(most pagers will accept just pressing the tab key in the search string, and it may show up as ^I or the literal tab character) -p
Potrzebie mode ...
So search for it, e.g., /^ *-p
The caret regex anchor matches at the beginning of line, and the Kleene star matches zero or more of the previous pattern. In English, the above pattern reads “match -p only when it occurs as the first nonblank characters on the line.”The surrounding context may be different, so adapt your search pattern accordingly.
man -k <keyword>To use the original example, once you've identified that $(...) is Command Substitution, you have something that pulls up meaningful results in every search engine.
Amusingly, reference documents are themselves increasingly rare, and what you usually get is a rough tutorial and set of examples that cover perhaps 15% of the feature set, and need to dive into the source to figure everything else out.
Not having to put every command in quotes, for example, is a huge advantage all by itself, especially if any argument lists have quoted arguments.
The $(...) construct is pretty fundamental to bash scripting and should be covered in any decent tutorial.