What is the syntax you write at the start?
!/bin/ksh
How do we allow our program to run in bash?
command 1:
chmod +x example.ksh
command 2:
./example.ksh
what is echo?
output
eg. echo hello
What is read?
Userinput when script is ran the saved to a variable
eg. read variable
What is cat?
display the content of a file
cat filename
What is cp?
To copy a file
cp source_file destination_file
How is a variable outputted?
using a $
variable = 15
echo $variable
What does who| wc -1 do?
displays the no. of users logged on
What is the equal to operators in bash?
-eq
What is the not equal to than operator in bash?
-ne
What is the less than or equal to operator in bash?
-le
What is the greater than operator in bash?
-gt
What is the equal to operators in bash?
-eq
What is the greater than or equal to operators in bash?
-ge
What is the file test operator (-e) in bash
Checks if a file exists
What is the file test operator (-d) in bash
Checks if a directory exists
What is the file test operator (-f) in bash
Checks if a file is a regular file
What is the file test operator (-s) in bash
Checks if a file is not empty
How is a if statement written in bash?
num=15
if [ condition ]; then
echo “Number is greater than 10”
fi
What is fi in an if statement in bash?
How the if statement ends?
How is a for statement written in bash?
for i in {1..5}; do
echo “Iteration $i”
done
what does date do?
Displays the current date and time
What does the variable $0 output?
Contains the name of the script
so if you run ./file.ksh
echo $0
console output: ./file.ksh
What does the variable $1,$2,…$9 output?
Contains the command line parameter for whatever number is next to(basically $3 output the third word)
so if you run ./file.ksh hi this is a test by myself
echo $2
console output: this
echo $4
console output: test
echo $5
console output: by