How do you assign variables in PowerShell?
Only language where its different
$varName=value
How do you display a variable to terminal in Bash?
echo $varName
How do you display a variable to terminal in PowerShell?
Write-Host $varName
How do you display a variable to terminal in Ruby?
puts varName
What are the comparison operators in Bash?
-eq (==), -ne (!=), -lt (), -ge (>=)
What are the comparison operators in PowerShell?
-eq, -ne, -gt, -ge, -lt, -le
What are the comparison operators in Ruby?
==, !=, >, >=,
What are the comparison operators in Python?
==, != (<>), >, >=,
What are the different kinds of loops in Bash?
For
What are the different kinds of loops in PowerShell?
For, While, Do-While, Do-Until
What are the different kinds of loops in Ruby?
while, until, for
What are the different kinds of loops in Python?
for, while
Flow Control in Bash
if condition
then
commands
elif
commands
else
commands
fiFlow Control in PowerShell
if (condition) {
statements
} elseif (condition) {
statements
} else {
statements
}Flow Control in Ruby
if condition then
statements
elsif
statements
else
statements endFlow Control in Python
if condition:
statements
elif condition:
statements
else:
statementHow to input from the terminal in Bash?
Read –p “Prompt:” var
How to input from the terminal in PowerShell?
$firstName = Read-Host –Prompt ‘Enter first name’
How to input from the terminal in Ruby?
name = gets
How to input from the terminal in Python?
Name = raw_input(‘Please enter your name’)
Error handling in Bash
If [“$?’ = “o”] then
Error handling in PowerShell
try {
Command
}
catch {
errHandling
commands
}Error handling in Ruby
begin
statements
rescue
statements if error occurred
else
statement if no error
endError handling in Python
try:
statements raise
except:
statements
customErrorObject
finally:
statements to clean up