Changes

Jump to: navigation, search

Tutorial10: Shell Scripting - Part 1

462 bytes added, 10:53, 3 March 2021
INVESTIGATION 3: COMMAND SUBSTITUTION / MATH OPERATIONS
Since you do NOT have to declare the data-type of a variable (like in a compiled language such as "'''C'''"),<br> numbers would be stored as '''text''' in variables. Therefore, it is important to use the construct <span style="color:blue;font-family:courier;font-weight:bold">(( ))</span><br><br>We can include numbers, variables and math operations within this construct to <u>convert</u> numbers (stored as ''text'') into '''numbers'''.
# Confirm that you are located in your '''home''' directory in your Matrix account.<br><br>
# To demonstrate the need for the '''( )''' construct, issue the following:<br><span style="color:blue;font-family:courier;font-weight:bold">echo "1 + 2"</span><br><br>What did you notice?<br><br>
# Issue the following (using that math construct):<br><span style="color:blue;font-family:courier;font-weight:bold">echo "$((1 + 2))"</span><br><br>What did you notice?<br>The '''$''' in front of the construct expands the result of the calculation.<br><br>
# x
=INVESTIGATION 4: USING CONTROL FLOW STATEMENTS =
13,420
edits

Navigation menu