Changes

Jump to: navigation, search

ULI101 Week 10

8 bytes removed, 21:37, 31 August 2017
test Command
echo Hello $name
</source>
 == Using Logic ==
The purpose of the if statement is execute a command or commands based on a condition. The condition is evaluated by a test command, represented below by a pair of square brackets
* Use <code>=</code> and <code>!=</code> to compare strings, for example: <code>[ ”$name” = ”Bob” ]</code>
* Use <code>-z</code> and <code>-n</code> to check string length, for example: <code>[ ! -z “$name” ]</code>* Use <code>-gt</code>, <code>-lt</code>, <code>-eq</code>, <code>-ne</code>, <code>-le</code>, <code>-ge</code> for number, for examplenumbers like: <code>[ ”$salary” -gt 100000 ]</code>
Common file test operations include:
221
edits

Navigation menu