0
0
Bash Scriptingscripting~10 mins

Variable assignment (no spaces around =) in Bash Scripting - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to assign the value 'hello' to the variable greeting.

Bash Scripting
greeting[1]"hello"
Drag options to blanks, or click blank then click option'
A:=
B=
C==
D<-
Attempts:
3 left
💡 Hint
Common Mistakes
Adding spaces around the equals sign causes syntax errors.
Using double equals (==) instead of a single equals.
2fill in blank
medium

Complete the code to assign the output of the date command to the variable today.

Bash Scripting
today[1]$(date)
Drag options to blanks, or click blank then click option'
A=
B==
C:=
D->
Attempts:
3 left
💡 Hint
Common Mistakes
Adding spaces around the equals sign.
Using == instead of = for assignment.
3fill in blank
hard

Fix the error in the variable assignment to set count to 5.

Bash Scripting
count[1]5
Drag options to blanks, or click blank then click option'
A<-
B==
C:=
D=
Attempts:
3 left
💡 Hint
Common Mistakes
Using spaces around the equals sign.
Using double equals (==) which is for comparison, not assignment.
4fill in blank
hard

Fill both blanks to assign the string 'world' to the variable name without spaces around the equals sign.

Bash Scripting
name[1][2]"world"
Drag options to blanks, or click blank then click option'
A=
B==
C"
D'
Attempts:
3 left
💡 Hint
Common Mistakes
Adding spaces around the equals sign.
Using single quotes instead of double quotes (both work but double quotes are common).
5fill in blank
hard

Fill all three blanks to assign the output of the command 'whoami' to the variable user with no spaces around the equals sign.

Bash Scripting
user[1]$([2][3])
Drag options to blanks, or click blank then click option'
A=
Bwhoami
C(nothing)
Dwho am i
Attempts:
3 left
💡 Hint
Common Mistakes
Adding spaces around the equals sign.
Using incorrect command names or extra spaces inside $().