# Basic syntax:
# This will run command_2 after command_1 regardless of whether command_1
# completes successfully or not:
command_1; command_2
# This will run command_2 after command_1 if command_1 completes successfully:
command_1 && command_2
# This will run command_2 after command_1 if command_1 fails:
command_1 || command_2
# This will pass (pipe) the standard output of command_1 to command_2:
command_1 | command_2
A; B # Run A and then B, regardless of success of A
A && B # Run B if and only if A succeeded
A || B # Run B if and only if A failed
A & # Run A in background.
# Basic syntax:
for i in a b; do echo $i; printf "$i $i
"; done
# Where:
# - each command in the for loop needs to be separated by semicolons. Here
# we echo $i and then print $i<tab>$i<newline>
# - over several lines this would be equivalent to:
for i in a b
do
echo $i
printf "$i $i
"
done
command1 && command2 OR
command1; command2 OR
command1 || command2