scripting:tutoriallist

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
scripting:tutoriallist [2015/06/13 12:57]
sps [Table]
scripting:tutoriallist [2018/02/18 14:47]
thebonsai old revision restored
Line 3: Line 3:
 {{keywords>​bash shell scripting review tutorial list recommendation}} {{keywords>​bash shell scripting review tutorial list recommendation}}
  
-Here's a list with some (by far **not all** of course) ​Bash tutorials ​found on the Internet.+Here's a list of some Bash tutorials.
  
 The primary purpose of that list is to lead beginners to //good tutorials// and not to the wrong ones. However, the secondary purpose is to provide information to increase quality of the linked tutorials. The primary purpose of that list is to lead beginners to //good tutorials// and not to the wrong ones. However, the secondary purpose is to provide information to increase quality of the linked tutorials.
  
-My expirience ​shows that nobody is interested when you "just send a mail to the author",​ even if he links a big "​contact me" in his article(s). This is another try of influencing the Bash world.+My experience ​shows that nobody is interested when you "just send a mail to the author",​ even if he links a big "​contact me" in his article(s). This is another try of influencing the Bash world.
  
  
Line 42: Line 42:
  
 ^ Name (Links to review below)j ​                                                                                  ^ Weblink\ \ \                                                                                                                                                                                                    ^ REC\\ indicator ​ ^ Comments ​                                                                                                                                                                                                                  ^ ^ Name (Links to review below)j ​                                                                                  ^ Weblink\ \ \                                                                                                                                                                                                    ^ REC\\ indicator ​ ^ Comments ​                                                                                                                                                                                                                  ^
-| Bash\ guide on Greg's wiki                                                                                      | [[http://​mywiki.wooledge.org/​BashGuide|click]] ​                                                                                                                                                                 | <​progress=90> ​   | This guide teaches modern stuff and good practises. I recommend ​to learn from it. It was written by the guys in ''#​bash''​IRC channel on Freenode (mainly ''​lhunath''​),​ because there are so many bad tutorials out there. ​ | +| Bash\ guide on Greg's wiki                                                                                      | [[http://​mywiki.wooledge.org/​BashGuide|click]] ​([[http://​guide.bash.academy|new revision draft]]) ​                                                                                                              | <​progress=90> ​   | This guide teaches modern stuff and good practises. I recommend ​learning ​from it. It was written by the guys in ''#​bash''​IRC channel on Freenode (mainly ''​lhunath''​),​ because there are so many bad tutorials out there. ​ | 
-| Steve Parker'​s shell scripting guide                                                                            | [[http://​steve-parker.org/​sh/​first.shtml|click]] ​                                                                                                                                                               | <​progress=90> ​   | Very good (not only Bash) shell scripting guide. Teaches good practices, gives background information. ​                                                                                                                    |+| Steve Parker'​s shell scripting guide                                                                            | [[http://​steve-parker.org/​sh/​intro.shtml|click]] ​                                                                                                                                                               | <​progress=90> ​   | Very good (not only Bash) shell scripting guide. Teaches good practices, gives background information. ​                                                                                                                    |
 | Bash Guide for Beginners ​ ([[#​rv_bgb|review]]) ​                                                                 | [[http://​tldp.org/​LDP/​Bash-Beginners-Guide/​html/​|click]] ​                                                                                                                                                       | <​progress=80> ​   | Good introduction that really requires no previous knowledge, also covers the most important unix utilities ​                                                                                                               | | Bash Guide for Beginners ​ ([[#​rv_bgb|review]]) ​                                                                 | [[http://​tldp.org/​LDP/​Bash-Beginners-Guide/​html/​|click]] ​                                                                                                                                                       | <​progress=80> ​   | Good introduction that really requires no previous knowledge, also covers the most important unix utilities ​                                                                                                               |
-| Advanced\ Bash\ Scripting\ Guide (ABS) ([[#​rv_abs|review]]) ​                                                    | [[http://​tldp.org/​LDP/​abs/​html/​|click]] ​                                                                                                                                                                        | <​progress=50> ​   | Has a lot of information that is hard to find, but is outdated and often unsafe. ​ To be avoided until you can filter out the good stuff. ​                                                                                  ​|+| Advanced\ Bash\ Scripting\ Guide (ABS) ([[#​rv_abs|review]]) ​                                                    | [[http://​tldp.org/​LDP/​abs/​html/​|click]] ​                                                                                                                                                                        | <​progress=50> ​   | Has a lot of information that is hard to find, is outdated and often unsafe. ​ To be avoided until you can filter out the good stuff. ​                                                                                      ​|
 | IBM developerWorks "Bash\ by\ example" ​                                                                         | [[http://​www.ibm.com/​developerworks/​library/​l-bash.html|click(1)]]\\ [[http://​www.ibm.com/​developerworks/​library/​l-bash2.html|click(2)]]\\ [[http://​www.ibm.com/​developerworks/​library/​l-bash3.html|click(3)]] ​ | <​progress=80> ​   | Doesn'​t teach outdated stuff, doesn'​t tell you wrong things. A good start, though not that detailed. ​                                                                                                                      | | IBM developerWorks "Bash\ by\ example" ​                                                                         | [[http://​www.ibm.com/​developerworks/​library/​l-bash.html|click(1)]]\\ [[http://​www.ibm.com/​developerworks/​library/​l-bash2.html|click(2)]]\\ [[http://​www.ibm.com/​developerworks/​library/​l-bash3.html|click(3)]] ​ | <​progress=80> ​   | Doesn'​t teach outdated stuff, doesn'​t tell you wrong things. A good start, though not that detailed. ​                                                                                                                      |
-| Deadman'​s ​                                                                                                      | [[http://www.deadman.org/bash.html|click(1)]]\\ [[http://​www.deadman.org/​bash2.html|click(2)]]                                                                                                                  | <​progress=70> ​   | Focus isn't scripting per se. Focus is interactive use and increasing the productivity on the prompt. Teaches some nice features. ​                                                                                         |+| Deadman'​s ​                                                                                                      | [[http://samrowe.com/wordpress/​advancing-in-the-bash-shell/​|click]] ​                                                                                                                                            ​| <​progress=70> ​   | Focus isn't scripting per se. Focus is interactive use and increasing the productivity on the prompt. Teaches some nice features. ​                                                                                         |
 | Bash Shell Programming in Linux (P. Lutus) ​                                                                     | [[http://​www.arachnoid.com/​linux/​shell_programming.html|click]] ​                                                                                                                                                | <​progress=70> ​   | Good start. Though there are small bugs.                                                                                                                                                                                   | | Bash Shell Programming in Linux (P. Lutus) ​                                                                     | [[http://​www.arachnoid.com/​linux/​shell_programming.html|click]] ​                                                                                                                                                | <​progress=70> ​   | Good start. Though there are small bugs.                                                                                                                                                                                   |
 | BASH Help at hypexr.org ([[#​rv_hypexrorg|review]]) ​                                                             | [[http://​www.hypexr.org/​bash_tutorial.php|click]] ​                                                                                                                                                              | <​progress=50> ​   | Shows you some nice stuff and links to other ressources. Not a tutorial to learn Bash, though. ​                                                                                                                            | | BASH Help at hypexr.org ([[#​rv_hypexrorg|review]]) ​                                                             | [[http://​www.hypexr.org/​bash_tutorial.php|click]] ​                                                                                                                                                              | <​progress=50> ​   | Shows you some nice stuff and links to other ressources. Not a tutorial to learn Bash, though. ​                                                                                                                            |
Line 57: Line 57:
 | Beginner\ Linux\ Tutorial ​                                                                                      | [[http://​linuxtutorial.todolistme.net|click]] ​                                                                                                                                                                  | <​progress=60> ​   | A comprehensive introduction to the Linux Command Line including ample examples to make learning easy.                                                                                                                     | | Beginner\ Linux\ Tutorial ​                                                                                      | [[http://​linuxtutorial.todolistme.net|click]] ​                                                                                                                                                                  | <​progress=60> ​   | A comprehensive introduction to the Linux Command Line including ample examples to make learning easy.                                                                                                                     |
 | Beginner\ Bash\ Scripting\ Tutorial ​                                                                            | [[http://​ryanstutorials.net/​bash-scripting-tutorial/​|click]] ​                                                                                                                                                   | <​progress=60> ​   | A beginners guide to Bash scripting under Linux. ​                                                                                                                                                                          | | Beginner\ Bash\ Scripting\ Tutorial ​                                                                            | [[http://​ryanstutorials.net/​bash-scripting-tutorial/​|click]] ​                                                                                                                                                   | <​progress=60> ​   | A beginners guide to Bash scripting under Linux. ​                                                                                                                                                                          |
-| Linuxcommand.org:​ The\ Linux\ Command\ Line                                                                     | [[http://​linuxcommand.org/​tlcl.php/​|click]] ​                                                                                                                                                                    | <​progress=60>    | A beginners guide to using Bash shell and basic unix utilities. ​                                                                                                                                                           | +| Linuxcommand.org:​ The\ Linux\ Command\ Line                                                                     | [[http://​linuxcommand.org/​tlcl.php/​|click]] ​                                                                                                                                                                    | <​progress=40>    | A beginners guide to using Bash shellbasic unix utilities, and shell scripting. Shell scripting part is not so good. But good introduction on how to use various utilities in Bash                                     |
 ===== Detailed reviews ===== ===== Detailed reviews =====
  
Line 74: Line 73:
   * uses ''​function SOMENAME''​ keyword instead of the common POSIX-compatible variant ''​SOMENAME()''​ to [[syntax:​basicgrammar#​shell_function_definitions|define a function]]   * uses ''​function SOMENAME''​ keyword instead of the common POSIX-compatible variant ''​SOMENAME()''​ to [[syntax:​basicgrammar#​shell_function_definitions|define a function]]
   * uses backticks instead of ''​$( ... )''​ for [[syntax:​expansion:​cmdsubst|command substitution]]   * uses backticks instead of ''​$( ... )''​ for [[syntax:​expansion:​cmdsubst|command substitution]]
-  * abuses ​an additional array to store [[scripting:​posparams|positional parameters]],​ disregarding that ''​$@''​ already is array-like+  * incorrectly uses an additional array to store [[scripting:​posparams|positional parameters]],​ disregarding that ''​$@''​ already is array-like
   * uses ''​echo -e''​ and the historical control character ''​\c''​ instead of modern [[commands:​builtin:​printf]]   * uses ''​echo -e''​ and the historical control character ''​\c''​ instead of modern [[commands:​builtin:​printf]]
   * uses ''​for a in `seq 1 10`''​ instead of a [[syntax:​ccmd:​c_for|C-like counter loop]] ''​for <​nowiki>​((a=1;​ a <= 10; a++))</​nowiki>''​   * uses ''​for a in `seq 1 10`''​ instead of a [[syntax:​ccmd:​c_for|C-like counter loop]] ''​for <​nowiki>​((a=1;​ a <= 10; a++))</​nowiki>''​
Line 80: Line 79:
   * a ''​for''​ loop example that **will** explode on [[syntax:​expansion:​wordsplit|word-splitting]]   * a ''​for''​ loop example that **will** explode on [[syntax:​expansion:​wordsplit|word-splitting]]
   * arithmetic tests (the while/until loop examples) using the historical "old way" with ''​test'',​ not [[syntax:​arith_expr|modern arithmetic components]]   * arithmetic tests (the while/until loop examples) using the historical "old way" with ''​test'',​ not [[syntax:​arith_expr|modern arithmetic components]]
-  * useless [[syntax:​quoting|quoting]] of one-word strings (not that it hurts per se, but it shows that the author has no clue why to use quotes) +  * useless [[syntax:​quoting|quoting]] of one-word strings (not that it hurts per se, but it shows that the author has no clue when to use quotes) 
-  * a weird construct I don'​t ​even understand (example for stdout/err redirection):​ ''​grep -r hda6 * . 1>&2 stderr.txt''​ +  * a weird construct I don't understand (example for stdout/err redirection):​ ''​grep -r hda6 * . 1>&2 stderr.txt''​ 
-  * ... some other things that are less important+
  
 ''​twkm''​ commented some things on their <​nowiki>​http://​www.linuxconfig.org/​Talk:​Bash_scripting_Tutorial</​nowiki>,​ I linked //this article// there. UPDATE: Discussion page is gone. ''​twkm''​ commented some things on their <​nowiki>​http://​www.linuxconfig.org/​Talk:​Bash_scripting_Tutorial</​nowiki>,​ I linked //this article// there. UPDATE: Discussion page is gone.
Line 113: Line 112:
   * a [[syntax:​ccmd:​classic_for|for-loop example]] will explode due to [[syntax:​expansion:​wordsplit|word splitting]] (''​for i in $( ls )''​ - evil!)   * a [[syntax:​ccmd:​classic_for|for-loop example]] will explode due to [[syntax:​expansion:​wordsplit|word splitting]] (''​for i in $( ls )''​ - evil!)
   * the mentioned C-like for-loop is not the [[syntax:​ccmd:​c_for|real C-like for-loop]], it just calls ''​seq(1)''​+   * the mentioned C-like for-loop is not the [[syntax:​ccmd:​c_for|real C-like for-loop]], it just calls ''​seq(1)''​+
-  * Many syntax errors: The examples ​don't even go through the parser+  * Many syntax errors: The examples ​won't even parse correctly
  
 I like the style this article is written in. If the points are fixed, it could be a really usable starting point for newbies. But at the moment it's unusable I like the style this article is written in. If the points are fixed, it could be a really usable starting point for newbies. But at the moment it's unusable
Line 137: Line 136:
 The only big problem I see with the ABS is, that the name doesn'​t match the reality. It doesn'​t teach //​advanced//​ techniques. That **doesn'​t mean** the guide isn't good! It's one of the biggest, most complete and interesting Bash guides I've seen. The only big problem I see with the ABS is, that the name doesn'​t match the reality. It doesn'​t teach //​advanced//​ techniques. That **doesn'​t mean** the guide isn't good! It's one of the biggest, most complete and interesting Bash guides I've seen.
  
-I don't want to write every point here that disturbs me. In general it's not that important since the mistakes or wrong assumptions it makes are minimal. Also I noticed that mistakes in example scripts vanish ​over the time, the author polishes his work. Thanks Mr. Cooper.+I don't want to write every point here that disturbs me. In general it's not that important since the mistakes or wrong assumptions it makes are minimal. Also I noticed that mistakes in example scripts vanish ​with time, the author polishes his work. Thanks Mr. Cooper.
  
-The ABS is definitely worth to read to step deeper into the Bash and commandline world of Linux (since many Linux-specific examples are there, they'​re unusable for Unices).+The ABS is definitely worth reading ​to step deeper into the Bash commandline world of Linux (since many Linux-specific examples are there, they'​re unusable for Unices).
  
  
Line 151: Line 150:
 Good introduction to bash and shell scripting, the guide is fairly ​ complete and requires almost no previous knowledge other than be able to type some commands in a shell. Good introduction to bash and shell scripting, the guide is fairly ​ complete and requires almost no previous knowledge other than be able to type some commands in a shell.
  
-Some advices are a bit strange or outdated "Real Programmers - Most programmers will prefer to use the test built-in command"​ "​Wherever possible, Bash users should try to use the syntax with angular brackets:​($[ ])" but all in all a nice tutorial to get a good overview of shell programming starting from 0.+Some advice is a bit strange or outdated "Real Programmers - Most programmers will prefer to use the test built-in command"​ "​Wherever possible, Bash users should try to use the syntax with angular brackets:​($[ ])" but all in all a nice tutorial to get a good overview of shell programming starting from 0.
  
 <​BOOKMARK:​rv_linuxscriptv2>​ <​BOOKMARK:​rv_linuxscriptv2>​
Line 161: Line 160:
 Additional problem: The author rates his shell skills as "9 of 10" in his CV. After reading this tutorial personally I'd rate him 3/10 Additional problem: The author rates his shell skills as "9 of 10" in his CV. After reading this tutorial personally I'd rate him 3/10
  
-This guide got some big problems. It seems to cover a lot of material but has some pretty nasty issues, too. Examples:+This guide has some big problems. It seems to cover a lot of material but has some pretty nasty issues, too. Examples:
   * <​del>​When showing how to echo variables, it shows echo ''​$var''​ and ''​echo ${var}''​ mostly without quoting.</​del>​   * <​del>​When showing how to echo variables, it shows echo ''​$var''​ and ''​echo ${var}''​ mostly without quoting.</​del>​
   * Lots of '​test'​ and not much '​['​. Not really a "​problem"​ - more a style thing. But...   * Lots of '​test'​ and not much '​['​. Not really a "​problem"​ - more a style thing. But...
-  * test and [ and great, but what happened to \[\[? And test == is not used to check two strings are equal. You want =.+  * test and [ and great, but what happened to \[\[? And test == is not used to check if two strings are equal. You use =.
   * <​del>​How to deal with case insensitive matching mentions converting to lowercase with tr and doing a pattern like [tT][aA][rR]. I propose a third solution: shopt -o nomasematch</​del>​   * <​del>​How to deal with case insensitive matching mentions converting to lowercase with tr and doing a pattern like [tT][aA][rR]. I propose a third solution: shopt -o nomasematch</​del>​
   * The for loop examples reads like a how-not-to. for i in <​don'​t do this>: < $(ls /​tmp/​*)>,​ <1 2 3 4 5>, <​$files>,​ <$*>. Don't parse ls. Use {1..5}. Use an array for a list of files. Use quotes (and $@).   * The for loop examples reads like a how-not-to. for i in <​don'​t do this>: < $(ls /​tmp/​*)>,​ <1 2 3 4 5>, <​$files>,​ <$*>. Don't parse ls. Use {1..5}. Use an array for a list of files. Use quotes (and $@).
   * The infinite-while-loop example has him reimplementing the bash select builtin. Not bad for an exercise, but it ought to acknowledge that bash does it better.   * The infinite-while-loop example has him reimplementing the bash select builtin. Not bad for an exercise, but it ought to acknowledge that bash does it better.
   * the description for compound commands is wrong: It shows 3 compound commands (grouping with and without subshell) where two of the examples are the same and the reason given for using ( ) applies equally to  { }   * the description for compound commands is wrong: It shows 3 compound commands (grouping with and without subshell) where two of the examples are the same and the reason given for using ( ) applies equally to  { }
-  * <​del>​the function definition ​focusses ​on the "​function"​ keyword, which is the worse way</​del>​+  * <​del>​the function definition ​focuses ​on the "​function"​ keyword, which is the worst way</​del>​
   * The initial example page for pipes seems like a good list of examples of parsing things-you-do-NOT-want-to-parse   * The initial example page for pipes seems like a good list of examples of parsing things-you-do-NOT-want-to-parse
-  * <​del>​the page explaining ​the special parameters misses $@, which is very important ​one</​del>​ +  * <​del>​the page explaining special parameters misses $@, which is very important</​del>​ 
-  * <​del>​the page(s) about shell variables and environment doesn'​t even mention "​environment"​ so far</​del> ​got better+  * <​del>​the page(s) about shell variables and environment doesn'​t even mention "​environment"​ so far</​del> ​some improvement
-  * <​del>​backticks are **not** a quoting mechanism, they are a substitution mechanism. but that doesn'​t matter since he doesn'​t mention all quoting mechanisms anyways</​del> ​got better, but the quoting page still is misleading +  * <​del>​backticks are **not** a quoting mechanism, they are a substitution mechanism. but that doesn'​t matter since he doesn'​t mention all quoting mechanisms anyways</​del> ​some improvement, but the quoting page is still misleading 
-  * <​del>​another hint that he doesn'​t know what he's talking about: It's said that command substitution is allowed inside backquotes (where backquotes are a quoting mechanism!) - backquotes ​**are** command substitution!</​del>​+  * <​del>​another hint that he doesn'​t know what he's talking about: It's said that command substitution is allowed inside backquotes (where backquotes are a quoting mechanism!) - backquotes are **command substitution!**</​del>​
   * etc. etc. etc. (nearly endless list, sadly)   * etc. etc. etc. (nearly endless list, sadly)
  
 **Conclusion** **Conclusion**
  
-Beside all the bashing (sorry!) above: I think the problem is the following, the author did alot using the shell, and he knows much things. Admitted. But he doesn'​t know and/or understand the underlying concepts of most of the stuff. This - in my personal opinion - disqualifies him as the author of a guide/​tutorial for shell scripting.+Beside all the bashing (sorry!) above: I think the problem is the following, the author did a lot using the shell, and he knows many things. But he doesn'​t know and/or understand the underlying concepts of most of the material covered. This - in my personal opinion - disqualifies him as the author of a guide/​tutorial for shell scripting.
  
 **But** **But**
Line 185: Line 184:
 The tutorial is under development. It improves here and there. But the code style and robustness problems still remain. The tutorial is under development. It improves here and there. But the code style and robustness problems still remain.
  
-**UPDATE:** Over the time, alot of things are fixed by the author and new chapters ​are created. From time to time I'll visit again and cross-read it.+**UPDATE:** Over time, the author ​fixed a lot of things ​and created ​new chapters. From time to timeI'll visit again and re-check it.
  
  
Line 198: Line 197:
  
   * Difference between startup files ''​.bash_profile''​ and ''​.bashrc''​ is wrong ("​Though placing your aliases and shell functions in your .bash_profile will work, it is not considered good form."​)   * Difference between startup files ''​.bash_profile''​ and ''​.bashrc''​ is wrong ("​Though placing your aliases and shell functions in your .bash_profile will work, it is not considered good form."​)
-  * Reserved words (for the parser) are **not** disallowed as shell variable names (if the name follows ​the other naming rules)+  * Reserved words (for the parser) are **not** disallowed as shell variable names (if the variable ​name is a reserved word, the reserved word takes precedence)
   * It suggests the ''​which''​ command, which might be popular here and there, but should not be used for various reasons   * It suggests the ''​which''​ command, which might be popular here and there, but should not be used for various reasons
-  * It says, variables with ''​UPPERCASE''​ names are constants, this might be a good style, but it's not a programming feature. Real "​constants"​ are made up from read-only variables +  * It says, variables with ''​UPPERCASE''​ names are constants, this might be a good style, but it's not a programming feature. Real "​constants"​ are made from read-only variables 
-  * Common mistake it shares with many other tutorials: The ANSI C escapes are not recognized by (normal) quoting mechanisms, it's the ''​echo''​ command that interprets them! On the other hand, it misses the quoting style that makes the shell interpreting ​ANSI C escape sequences.+  * Common mistake it shares with many other tutorials: The ANSI C escapes are not recognized by (normal) quoting mechanisms, it's the ''​echo''​ command that interprets them! On the other hand, it misses the quoting style that makes the shell interpret ​ANSI C escape sequences.
   * It suggests the ''​function''​ keyword to define a function, which is correct, but bad style and unportable   * It suggests the ''​function''​ keyword to define a function, which is correct, but bad style and unportable
   * It could use ''​getopts''​ for positional parameters, at least as an "​advanced example"​   * It could use ''​getopts''​ for positional parameters, at least as an "​advanced example"​
-  * It uses the special parameters that represent ​the positional parameters (''​$@''​) unquoted, and thus unsafe or buggy +  * It uses special parameters that represent positional parameters (''​$@''​) unquoted, and thus unsafe or buggy 
-  * Slightly wrong: ​Not only ''​SIGKILL''​ can't be trapped, also the process stop signal. But that shouldn'​t really matter for daily shell coding +  * Slightly wrong: ''​SIGKILL'' ​and the process stop signal ​can't be trapped. But that shouldn'​t really matter for daily shell coding 
-  * "​Creating safe temporary files",​ which is about creating ​an unique name, should mention tools like ''​mktemp''​ or thelike +  * "​Creating safe temporary files",​ which is about creating ​unique name, should mention tools like ''​mktemp''​ or the like 
-  * It's far from complete, it "​suddenly stops"​. Maybe it's still under development+  * It's far from complete, it "​suddenly stops"​. Maybe it's still under development?
  
 __**Good:​**__ __**Good:​**__
  
   * Practise oriented   * Practise oriented
-  * It explains the behaviour of unquoted variable arguments to the ''​test''​ command in a nice and understandable way +  * It explains the behaviour of unquoted variable arguments to the ''​test''​ command in a niceunderstandable way 
-  * It does not use ''​expr''​ or ''​let''​ for arithmetics, good+  * It does not use ''​expr''​ or ''​let''​ for arithmetic, good
  
  • scripting/tutoriallist.txt
  • Last modified: 2019/08/31 10:17
  • by ersen