User Tools

Site Tools


bash:brackets

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
bash:brackets [2021/01/09 13:57] – [Escaping of Parentheses] peterbash:brackets [2021/01/09 13:59] (current) – [Rule of Thumb] peter
Line 208: Line 208:
 ===== Rule of Thumb ===== ===== Rule of Thumb =====
  
-As a rule of thumb, [[ is used for strings and files.+As a rule of thumb, **[[** is used for strings and files.
  
 If you want to compare numbers, use an ArithmeticExpression, e.g. If you want to compare numbers, use an ArithmeticExpression, e.g.
Line 218: Line 218:
 </code> </code>
  
-When should the new test command <nowiki>[[</nowiki> be used, and when the old one <nowiki>[</nowiki>?  If portability/conformance to POSIX or the Bourne Shell is a concern, the old syntax should be used.  If on the other hand the script requires BASH, Zsh, or KornShell, the new syntax is usually more flexible, but not necessarily backwards compatible.+When should the new test command <nowiki>[[</nowiki> be used, and when the old one <nowiki>[</nowiki>?
  
-For reasons explained in the theory section belowany problem with an operator used with <nowiki>[[</nowiki> is an unhandleable parse-time error that will cause bash to terminate, even if the command is never evaluated. +  * If portability/conformance to POSIX or the Bourne Shell is a concernthe old syntax should be used. 
 +  * If on the other hand the script requires BASH, Zsh, or KornShell, the new syntax is usually more flexible, but not necessarily backwards compatible. 
 + 
 +<WRAP info> 
 +**NOTE:**  Any problem with an operator used with **<nowiki>[[</nowiki>** resulting in an unhandleable parse-time error will cause bash to terminate, even if the command is never evaluated. 
 +</WRAP> 
 + 
  
bash/brackets.1610200650.txt.gz · Last modified: 2021/01/09 13:57 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki