NEW
Font size
WorksheetsEthical Hacking Kali Linux Part 3
Total questions: 10
Worksheet time: 5mins
What is the correct shebang line to start a Bash script?
#!/usr/bin/python
#!/bin/bash
#!/bin/sh
#!/bash
What is the correct way to define a variable in Bash?
name = "Alex"
name: Alex
name="Alex"
$name = Alex
What will the following script output?
x=5
echo $x
$x
x
5
x=5
Which conditional statement is used for multiple conditions?
elseif
elif
else if
ifelse
What does the if block below check?
if [ $num -eq 10 ]; then
echo "Ten"
fi
If num is less than 10
If num is equal to 10
If num is a string
If num is undefined
Which loop executes a set of commands for a given range?
until loop
while loop
for loop
case loop
What is the output of the script?
for i in {1..3}; do
echo $i
done
123
1 2 3
1 2 3 on one line
1 (newline) 2 (newline) 3 (newline)
How do you define a function in Bash?
function greet() { echo "Hi"; }
function greet[]
greet = function()
function greet() { echo "Hi"; }
define greet() => {}
What does $1 refer to in a Bash script?
The number of variables
The script name
The script line number
The first argument passed to the script
