warp back | |
This is personal knowledgebase. | |
Latest change: May 25 15:00:21 2018 | |
All pages (by name) | |
Recent changes | |
Search content (case insensitive) | |
Search names (case insensitive) | |
Articles by date | |
Cheatsheet only | |
Latest article: | |
2018-03-08 article-script-survival.md: | |
% date: 2018-03-08 | |
POSIX Shell Scripting Survival Guide | |
==================================== | |
Authors: ulcer <[email protected]> | |
License: CC-BY-SA 4.0 | |
Published: 2018-03-08 | |
Updated: 2018-05-08 | |
Link: gopher://sdf.org/0/users/ulcer/kb/kb/article-script-survival.md | |
Mirror: https://uuuuu.github.io/article-script-survival.txt | |
Buy me cookies: https://patreon.com/ulcer | |
Table of contents: | |
1. Introduction | |
1.1. Note on shells: bourne shell syntax, bashisms and POSIX | |
1.2. Tools of trade: BSD userland, GNU coreutils | |
1.3. Shell scripting limitations | |
2. Scripting basics | |
2.1. echo vs printf and few more details | |
2.2. Variables, eval and quotation | |
2.3. Conditions and loops: if, while | |
2.4. Options parsing and validation: getopt vs getopts, case | |
2.5. Life without arrays | |
2.6. Change file | |
2.7. Check lock | |
3. Commentary on tools | |
3.1. Working with pipes: stdbuf and pv | |
3.2. Notes on grep | |
3.3. Notes on sed | |
3.4. Notes on awk | |
3.5. Notes on portable syntax | |
3.6. Notes on UTF-8 compatibility | |
3.7. Working with XML and HTML: curl, tidy, xmlstarlet and others | |
3.8. Working with JSON: jq | |
3.9. Working with CSV: miller | |
4. Advanced topics | |
4.1. Reading user input | |
4.2. Internal field separator | |
4.3. Command line options manupulation | |
4.4. Nested constructions difficulties and recursion | |
4.5. Libraries and trap cascading | |
4.6. Debugging | |
4.7. Testing and deploying in new environment | |
4.8. Networking with shell | |
4.9. Paste safety | |
5. Further reading | |
6. References | |
7. Changelog | |