Scripting Basics Flashcards
Script
A program written in an interpreted language, typically associated with a shell or a compiled program.
What does ‘&’ mean in a script
- Allows for multiple programs to be launched
- Tells the script it can continue without waiting for the command to finish executing
find command
Find a file based on filenames, ownership, and other permissions at that file system level
cut command
Extract text from a field within a file.
Echo command
Display a message in the command line window.
Arguments
Variables that are passed to the script. These are also called parameters
Conditional Expressions
Enable a script to perform one of several actions relying on a particular condition or value of a variable
&&
logical and
||
logical or
if then fi
- If then statement
- close with fi
case
- Uses a variable, and each pattern shown before the right parenthesis is a possible value of that variable.
- If the user’s entry is equal to the value before the parenthesis, the case is run.
- Like a menu, avoid redundant nested if/then
Loops
Tell the script to perform the same task repeatedly
seq command
Generates a list of numbers starting from its first argument and continuing to its last one
while loop
Execute as long as the condition is true
until loop
Continues to execute as as its conditions is false or until the condition becomes true