9 ms·
As much as people use the shell, it’s regrettable how few have actually read the manual. Anything you use for extended periods of time on a regular basis is wo
by teddyh 8y ago
As much as people use the shell, it’s regrettable how few have actually read the manual. Anything you use for extended periods of time on a regular basis is worth sitting down and reading the manual for.
- nerdponx 8y agoWith a manual as labyrinthine and disorganized as Bash's, in my mind they are forgiven for not being able to struggle through it. It makes even the Zsh manual seem delightfully lucid by comparison.
- dredmorbius 8y agozsh accomplishes that by partitioning. Overall it's over 3x the size of the bash manpage; https://news.ycombinator.com/item?id=19892608 https://news.ycombinator.com/item?id=19892608
- zwischenzug 8y agoI think the bash manual page (and others) intimidates people with its concise and (to the outsider) jargon. I often describe my bash book as an attempt to carefully demystify the man page so that you can approach it with confidence.
- teddyh 8y agoInstead of some proprietary book, I would suggest people read the classic Advanced Bash-Scripting Guide: http://tldp.org/guides.html#abs http://tldp.org/guides.html#abs Beginners might prefer the Bash Guide for Beginners: http://tldp.org/guides.html#bbg http://tldp.org/guides.html#bbg The Bash manual page is concise because it is a Unix manual page. Unix manual pages are supposed to be concise, because they are meant to be reference documents, not tutorials. In the GNU project, this is what the Info documentation is for. However, the bash project has elected not to maintain such a document, so the above documents from TLDP (The Linux Documentation Project) are the next best thing.
- dredmorbius 8y agoThat said, drop everything and get you some Jerry Peek; https://www.worldcat.org/title/from-bash-to-zshell-conquering-the-command-line/oclc/939074559&referer=brief_results https://www.worldcat.org/title/from-bash-to-zshell-conquerin... https://www.worldcat.org/title/learning-the-unix-operating-system-a-concise-guide-for-the-new-user/oclc/847931076&referer=brief_results https://www.worldcat.org/title/learning-the-unix-operating-s...
- Sharlin 8y agoThe bash man page is simply way too long, and IMHO not organized very clearly. And man pages don't even have a table of contents, never mind hyperlinks. The info version is naturally better in those respects, though.
- nickjj 8y agoI think that's a testament to how successful shell scripting is. Somehow you can be really productive and write useful tools without really ever diving deep into the docs. I've written literally thousands of lines of shell scripts (maybe even 10k+) across dozens of scripts over the years and I've only really looked at the docs a couple of times. Of course I'm Googling various syntax things that are humanly impossible to remember, but I never once really sat there and combed through all of the docs or even read a book on Bash. You can't do that with most programming languages.
- DonHopkins 8y agoSome of us actually have to USE shell scripts written by other people who like to brag about only looking at the doc a couple of times, who just copy and paste things they found in outdated pages on google into hodge-podges of frankenscripts, and who then run them as root at regular intervals on unattended servers. It may be care free, fun, and effortless for you, but try being on the receiving end of that behavior some time. RTFM! And if the manual sucks (like the Bash manual), then learn to use another language. Instead of learning to write shell scripts better, people should learn NOT to write shell scripts, and learn a decent scripting language instead. You will find that most decent scripting languages like Python are actually a hell of a lot easier to learn and program and maintain than shell scripts.
- mirkules 8y agoJust to add, I generally prefer shell scripts over Python because it is supported in all my use-cases out-of-the-box. However, I recently discovered the power of Python’s Fabric scripts, and holy cow... the ability to run functions on multiple computers at the same time based on roles is amazing (even if the “join” syntax is cumbersome as hell). I think in general, simple system things should be written as scripts. The moment you realize “this is going to take a LOT of scripting” it’s time to look at Python because chances are there’s a module for that.
- nickjj 8y agoIf you like writing things that you can execute on multiple machines take a look at Ansible. It's a Python based configuration management tool where a majority of what you write is YAML and Jinja 2 templates. But on that note, a majority of my current shell scripts are being used on my dev box to improve my day to day. Things like this: https://github.com/nickjj/invoice https://github.com/nickjj/invoice
- mistrial9 8y ago"the manual" is a form of communication for humans. Something nix has been de-prioritizing for thirty years! By experience, the nix culture has been "if you do not understand this, you should not be here" and a low-level hostility towards questions and learning, comes from some science gestalt in the 1800's German or something. *nix is friendly, it is just selective in who its friends are" .. is a dot-signature from that era A manual is a reading experience, a working reference system, and relies on the visual context it is presented in. There are vast differences in the quantitative and qualitative contents of manuals, on the same content! The BASH man page is .. improving ? Specifically compare an alphabetized list of every option, including "change the preferred shortcut" and "let the sea-water in, thereby killing everyone if you are underwater" .. are right next to each other .. to modern manuals in say, the Python culture. Specifically compare say, huge amounts of text supplied for some obscure option that is not at all needed, to a terse one-liner for something crucial that is used everyday. The parent comment cheerfully "blames the victim" with implied guilt for "not reading the manual" as if more time and effort on the part of the user, is the answer to the communication problem posed with such a dense and subtle realm. Last thing in this rant is, that a small interesting article on something specific is an antidote to the largely unsolvable challenge here, so good on that.
- blattimwind 8y ago> a low-level hostility towards questions and learning, comes from some science gestalt in the 1800's German An oddly specific comparison.
- detaro 8y agoI don't think you can generalize that. E.g. some of the BSDs pride themselves in great documentation. The shell manuals are not just alphabetical lists, but sort-of guides to their programming languages. etc.
- nwatson 8y ago> The BASH man page is .. improving? When I had to start dealing with bash a lot about 5 years ago I consulted "Greg's Bash Wiki" at https://mywiki.wooledge.org/BashGuide https://mywiki.wooledge.org/BashGuide and it pretty comprehensively treats best practices for writing bash scripts. I often go back to consult the guide.
- nwellnhof 8y agoIf you want to read the manual, start with the POSIX shell documentation: https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/utilities/V3_chap02.html https://pubs.opengroup.org/onlinepubs/9699919799.2018edition... It's quite compact and helps to write portable shell scripts.
- shrimp_emoji 8y agoBash is painful and awful, IMO. The last thing I want to do (if I were even capable of comprehending the man pages) is really learn it and internalize its awfulness (same with, say, Vim); I want to be able to do what I want to with some syntax quickly glued on from StackOverflow. Actually, I don't want to do that either. What I really want to do is use a Python script instead. :3
- Pawamoy 8y agoBut using Python is very painful as well for shell use-case. Do you really want to open files, subprocesses, and create fifo manually instead of typing "cmd1 | cmd2 > output"? Then you have Xonsh, but in my opinion, switching between the two contexts, shell and python, at each part of a command was too difficult. I was totally lost even at writing very basic commands.
- thatoneuser 8y agoIt'd also be worth writing a human readable man page...
- dredmorbius 8y agoThe bash manpage ... runs longish. 110 pages as 'man bash | pr". I do read it, frequently, though it's hard to assimilate in total andI constantly find new or unexpected things (after 20+ years). Checking zsh by comparison: 6 pages, though a long "SEE ALSO" list with 10 zsh-specific entries, totalling 374 pages in all: for zsh in zsh zshbuiltins zshcompwid zshcompsys zshcompctl \ zshexpn zshmisc zshmodules zshoptions zshparam zshzle; do\ man $zsh | pr | grep 'Page *[0-9][0-9]*$' | tail -1; \ done | awk '{tot+=$NF}; END{print tot}'
- teddyh 8y agoThe bash manual page is 78 pages as rendered to proper PostScript using man -t.
- dredmorbius 8y agoI specified both result and methodology. Yes, a different method gives a different result. Using pr allows rapid verification of numerous manpages as in the zsh manpages example shown, for validation. I'm aware that generating postscript is possible, and results in fewer pages. But that doesn't readily permit comparisons with simple shell tools. (The output is decidedly pretty though.)