Shell

Shell, also known as Bourne Shell Programming written by Steve Bourne, appeared in the 7th Edition Bell Labs Research of Unix. Its purpose is to automate computing procedures such as a list of commands, pretty much like a cooking recipe to a chef.


Overview of the Guide

For this section of guides, you will learn SHELL as a programming language (yes it is possible) but comes as a price: self-discipline. Otherwise, abusing it might ends up another stage of Javascript horror. There are 2 main variants I'm currently supporting:

  1. The POSIX Compliant Bourne Shell (also known as sh)
  2. The Bourne-Again Shell (known as BASH)

Why bash? more of the supports across Linux OSes and commonly used in desktop and server.


Shell Usefulness

Folks learn shell script mainly for:

  1. fun and easy to use
  2. integrate various complexity of programs together easily
  3. automation

Of course, once in a while, you'll meet some crazy folks like me who turn it into a day-to-day programming language.


Supported Types

There are various Shell variants in the market. In this guide, we only focus on 2 types:

  • POSIX compliant type - the one that works everywhere
  • BASH type - the one upgraded for using shell as a programming languages


What to do Next

If you're ready, use the navigation bar to find the guide of the one type you're looking for. I had arranged the topic in a sequential manner for easy references. You can also read through the materials I did for producing this guide!


References

  1. http://wiki.bash-hackers.org/scripting/debuggingtips
  2. https://www.thegeekstuff.com/2008/09/bash-shell-take-control-of-ps1-ps2-ps3-ps4-and-prompt_command/
  3. https://stackoverflow.com/questions/13710806/how-to-replace-placeholder-character-or-word-in-variable-with-value-from-another
  4. https://stackoverflow.com/questions/11650840/linux-remove-redundant-paths-from-path-variable
  5. https://www.amazon.com/gp/search?index=books&linkCode=qs&keywords=9781118024485
  6. https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html
  7. http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html
  8. http://mywiki.wooledge.org/BashFAQ/031
  9. http://mywiki.wooledge.org/
  10. https://serverfault.com/questions/52034/what-is-the-difference-between-double-and-single-square-brackets-in-bash
  11. http://mywiki.wooledge.org/BashPitfalls
  12. http://mywiki.wooledge.org/BashGuide/TestsAndConditionals
  13. https://stackoverflow.com/questions/44688460/bash-script-pattern-matching
  14. https://www.tldp.org/LDP/abs/html/subshells.html
  15. https://mywiki.wooledge.org/BashProgramming
  16. http://wiki.bash-hackers.org/syntax/pe
  17. https://www.gnu.org/software/bash/manual/html_node/Bash-POSIX-Mode.html
  18. http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02
  19. https://stackoverflow.com/questions/6499486/how-to-mark-an-array-in-posix-sh
  20. https://stackoverflow.com/questions/34434157/posix-sh-syntax-for-for-loops-sc2039
  21. http://tldp.org/LDP/GNU-Linux-Tools-Summary/html/x11655.htm
  22. https://stackoverflow.com/questions/35693980/test-for-regex-in-string-with-a-posix-shell
  23. https://stackoverflow.com/questions/21115121/how-to-check-pattern-match-by-using-bin-sh-not-by-bin-bash
  24. https://unix.stackexchange.com/questions/409065/how-does-curly-brace-expansion-work-in-the-shell
  25. http://www.linfo.org/wildcard.html
  26. https://unix.stackexchange.com/questions/37313/how-do-i-grep-for-multiple-patterns-with-pattern-having-a-pipe-character
  27. https://askubuntu.com/questions/621981/for-loop-syntax-in-shell-script
  28. https://stackoverflow.com/questions/34256437/shell-bash-how-to-prompt-a-user-to-select-from-a-dynamically-populated-list
  29. https://aty.sdsu.edu/bibliog/latex/debian/bash.html
  30. https://stackoverflow.com/questions/40681745/capitalize-each-input-string-in-shell-script
  31. https://unix.stackexchange.com/questions/312280/split-string-by-delimiter-and-get-n-th-element
  32. https://stackoverflow.com/questions/51052475/how-to-iterate-over-the-characters-of-a-string-in-a-posix-shell-script
  33. https://stackoverflow.com/questions/369758/how-to-trim-whitespace-from-a-bash-variable
  34. https://www.unix.com/shell-programming-and-scripting/17374-strip-leading-trailing-spaces-only-shell-variable-embedded-spaces.html
  35. https://stackoverflow.com/questions/10929453/read-a-file-line-by-line-assigning-the-value-to-a-variable
  36. https://pubs.opengroup.org/onlinepubs/009695399/utilities/read.html
  37. https://stackoverflow.com/questions/5014823/how-to-profile-a-bash-shell-script-slow-startup
  38. https://askubuntu.com/questions/915132/measure-performance-of-a-fast-bash-script
  39. https://www.linuxquestions.org/questions/linux-newbie-8/time-difference-calculation-4175459414/
  40. https://askubuntu.com/questions/274349/getting-cpu-usage-realtime
  41. https://stackoverflow.com/questions/3601515/how-to-check-if-a-variable-is-set-in-bash