Difference between revisions of "Bash"

From John Freier
Jump to: navigation, search
(One line conditional)
(One line conditional)
Line 2: Line 2:
 
== One line conditional ==
 
== One line conditional ==
 
Both the following lines will write to the screen "false"
 
Both the following lines will write to the screen "false"
   [\[ 1 == 0 \]\] || echo "text"
+
   [[ 1 == 0 \]\] || echo "text"
  
 
   \[\[ 1 == 1 \]\] && echo "text"
 
   \[\[ 1 == 1 \]\] && echo "text"

Revision as of 16:21, 29 April 2021

One line conditional

Both the following lines will write to the screen "false"

 [[ 1 == 0 \]\] || echo "text"
 \[\[ 1 == 1 \]\] && echo "text"