Verified Commit 179a471e authored by doshitan's avatar doshitan

Add Greg's Wiki to shell page

parent a0c77275
......@@ -204,12 +204,12 @@ set -e
At the top of the script can help with that. There are [[https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html][many flags]] to explore.
Some common ones:
- ~-e~: causes the shell to exit immediately if a command returns a non-zero
status
status, though it's [[http://mywiki.wooledge.org/BashFAQ/105][not perfect]]
- ~-x~: echo each command before it runs it, like ~make~, often useful in CI
scripts when you want to be able to inspect what it's running
- ~-u~: treats unset variables and parameters as errors, so if you expect
something to be set or require a positional argument by referencing say ~$2~,
this helps avoid continuing running without it
this helps avoid continuing running without it, [[http://mywiki.wooledge.org/BashFAQ/112][some discussion on it]]
A full loaded line like:
......@@ -401,11 +401,16 @@ the shell (or @@html:<kbd>Ctrl-d</kbd>@@).
a no-op on occasion or a quick way to ignore the failure of a command
(~command || :~), but often using ~true~ is more readable.
* More resources
- [[http://mywiki.wooledge.org/][Greg's Wiki]] is a great resource, includes a [[http://mywiki.wooledge.org/BashFAQ][Bash FAQ]], [[http://mywiki.wooledge.org/BashPitfalls][common
pitfalls]], [[http://mywiki.wooledge.org/BashGuide][learning guide]], [[http://mywiki.wooledge.org/BashSheet][reference sheet]], and more.
- The [[https://wiki.bash-hackers.org/][Bash Hackers Wiki]] is a wonderful reference. Skim it, pick something you
don't recognize and learn about it.
- The [[https://www.tldp.org/LDP/abs/html/][Advanced Bash-Scripting Guide]] is a solid introductory text if you are just
getting started shell scripting and want something structured to read. But
also a ton of advanced topics, *with examples*, and reference material.
- The [[https://www.tldp.org/LDP/abs/html/][Advanced Bash-Scripting Guide]] can be a solid reference, I often find
myself there, but it hasn't been updated in a while, and [[http://wooledge.org/~greybot/meta/abs][some discourage using
it]] as it can show some outdated/unsafe/buggy approaches, so best to refer to
once you know how to filter out the junk. But it covers a ton of advanced
topics, *with examples*, and makes reasonable reference material.
- It depends on your system, but the man page for your shell will either be
helpful or only something for masochists, try ~man bash~.
- https://github.com/jlevy/the-art-of-command-line
- https://awesome-shell.readthedocs.io/en/latest/README/
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment