Anyway, I found it interesting, but can't seem to find any sort of documentation on the double dash. The other two commands exist in the grep family. The E option is used with the grep command to execute extended regular expressions. The basic regular expression is used in the grep command by default. These are basic, extended, and Perl-compatible. I'm not sure why the scripter decided to search for the links in this manner. Three types of regular expressions are supported by the grep command. \n+ matches a line-feed (newline) character. The intent of the line is to have a long listing of a directory piped to it, and for it to count off the symbolic links based on the '->' characters. ![]() (?=\n+\s+-) Positive Lookahead: Assert that the Regex below matches:.* Quantifier - Matches between zero and unlimited times, as many times as possible, giving back as needed ( greedy) \n* matches a line-feed (newline) character.*? Quantifier - Matches between zero and unlimited times, as few times as possible, expanding as needed ( lazy) Working with a simple function to return only the specific part related to the command's switches and their followed short-description in addition, from their man-pages directly: sman() \E Quoted Literals - matches the expanded $2 characters literally One could obviously also use apropos in Linux.įull-text search for man pages - At Unix SE Test run: $ man shutdown | grep - '-' | grep '^]*-' On success, 0 is returned, a non-zero failure code otherwise.Īs glenn jackman commented below (very useful):Īnd to narrow down the results to just lines starting with a hyphen: grep '^]*-' – Shutdown may be used to halt, power-off or reboot the machine.Įquivalent to -poweroff, unless -halt is specified.ĭo not halt, power-off, reboot, just write wall message.ĭo not send wall message before halt, power-off, reboot. GREPOPTIONS - default options GREPCOLOR - The marker for highlighting LCALL, LCCOLLATE, LANG - These variables specify the LCCOLLATE locale, which determines the collating sequence used to interpret range expressions like a-z. Shutdown - Halt, power-off or reboot the machine Greps behavior can be affected by setting the following environment variables. Would this work in your case? $ man ls | grep - '-a'Ī more detailed (hopefully clearer) example of the command: $ man shutdown | grep - '-'
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |