Additions:
See [[CommandTest test]] for information on the test ("[") command
[[CommandTest]]
[[CommandTest]]
Deletions:
Additions:
[[CommandsTest]]
Additions:
Conditions can be tested with either the boolean operations ""||"" and "&&" or with the if/elif/else/then clauses.
Deletions:
Additions:
Conditions can be tested with either the boolean operations ""||"" and "&&" or with the the if/elif/else/then clauses.
Deletions:
Additions:
[[CategoryHowTo]]
Additions:
[[HowTo]]
Deletions:
Additions:
XML Expressions can also be used as conditons [[HowToXMLCondition]]
Additions:
----
[HowTo]
[HowTo]
No Differences
Additions:
command && echo is success
[ -e myfile.txt ] && { read VAR < myfile.txt ; echo $VAR ; }
[ -e myfile.txt ] && { read VAR < myfile.txt ; echo $VAR ; }
Deletions:
$ [ -e myfile.txt ] && { read VAR < myfile.txt ; echo $VAR ; }
Additions:
The "elif" and "else" parts are optional.
For example, if the file "myfile.xml" exists then read it into a variable otherwise print an error message
if [ -f myfile.xml ] ; then
xread var < myfile.xml
else
echo File myfile.xml does not exist
For example, if the file "myfile.xml" exists then read it into a variable otherwise print an error message
if [ -f myfile.xml ] ; then
xread var < myfile.xml
else
echo File myfile.xml does not exist
Deletions:
Additions:
The conditional test the return status of commands. If the command returns 0 then that is considered "true", otherwise the condition is "false". A common command used for conditionals is the "test" command, usually using the "[ test ]" syntax.
The "elif" and "else" parts are optional.
The "elif" and "else" parts are optional.
Additions:
====Structured Conditionals (if / elif / else / fi )====
If the condition or conditional operations are more complicated then the structured conditionals are more useful.
This is the if / elif / else / fi construct.
The general form is
if condition1 ; then
condition1 commands
elif condition2 ; then
condition2 commands
else
otherwise commands
fi
If the condition or conditional operations are more complicated then the structured conditionals are more useful.
This is the if / elif / else / fi construct.
The general form is
if condition1 ; then
condition1 commands
elif condition2 ; then
condition2 commands
else
otherwise commands
fi