Open main menu

CDOT Wiki β

Changes

OPS245 Scripting Exercises dev

18 bytes added, 15:09, 14 January 2023
Variables
$? is a special variable that contains the exit code of the last executed command. Linux uses an exit code of 0 to represent success. Any non-zero value represents failure. To check the exit status of the last command use '''echo $?'''.
=== Variables in Bash vs Python ===
==== Bash Variables ====
In ULI101 you learned about Bash variables. You can create a variable in bash at any time. You do not have to assign variable types to variables in Bash. Bash variables are character strings by default, but act as other data types based on the context you use them. For example, when you perform a math operation on two variables in bash they are treated as numbers.