Intro to Scripting 2 - Bash

In a bash script, what is the keyword used to output to the terminal
echo
print
output
write
echo
In a bash script, to output the results of 5*5 what would be the correct syntax
echo $((5*5))
echo $(5*5)
echo ((5*5))
echo $((5)*(5))
echo $((5*5))
In bash how is a function named test declared
test() {
function test() {
def test():
def test {
test() {
When executing a bash function that accepts 3 inputs by using the following command test "word" 54 1 What is the value of $2
54
test() {
there is no way to know without reading the function code
1
54
In bash, what is the syntax to create a function called math with 2 parameters
math() {
math(x,y) {
def math(x,y):
function math() {
math() {
What is the syntax to create a while loop that will output the value of y as long as it is lower than 10
y=0 while [$y -lt 10]; do echo $y done
y=0 while [$y -lt 10]; do echo "y" y=y+1 done
y=0 while [$y -le 10]; do echo $y ((y++)) done
y=0 while [$y -lt 10]; do echo $y ((y++)) done
y=0 while [$y -lt 10]; do echo $y ((y++)) done
in a bash script what is a valid method of incrementing the integer i by 1
-I
ii
i+
i++
i++
A bash loop uses an array called months. What is the correct syntax to create the array?
months=("Jan" "Feb" "Mar" "Apr" "May")
months=["Jan","Feb","Mar","Apr","May"]
months=[Jan,Feb,Mar,Apr,May]
months=("Jan","Feb","Mar","Apr","May")
months=("Jan" "Feb" "Mar" "Apr" "May")
A bash loop has the following command: for x in "${months[@]}"; do … What does ${months[@]} achieve
this defines the array "months" and uses the @ symbol to indicate each value of the array
This is an incorrect command and doesn’t achieve anything, bash doesn’t understand the @ symbol
this creates a new variable called @
this defines the array "months" as an array that will be added to, the @ symbol is a variable that will be used to add data to the array
this defines the array "months" and uses the @ symbol to indicate each value of the array
In bash, when creating a conditional statement with 3 conditions, what is the correct order of commands?
if <condition> elif <condition> else <condition> fi
if <condition> else <condition> fi <condition>
if <condition> elif <condition> else <condition>
if <condition> elif <condition> fi <condition>
if <condition> elif <condition> else <condition> fi
Your Score
Score Label
Score Summary