Shell Scripting Flashcards

1
Q

What is a shell script for?

A

Automation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

!

A

Schbang. Used to specify the shell or program that runs the shell script

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Shel scripting variablez

A

All upper case
Case sensitive

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

$

A

Used to add a variable to a command in shell scripting

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Add the ouput of a command to a variable by

A

Putting a $() around the output

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

[]

A

The wrapping for a condition in shell scripting

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

if []
then

A

Full conditional format for shell scripting

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

if []
then
else

A

Shell scripting with if / else

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

for var in item1 item2 (ect)
do
command 1
command 2
done

A

For in shell scripting. Note that you need to manually specify all iitems to iterate through

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

$0

A

The script

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

$1, $2 , $3

A

Parameters to feed when executing the script

Eg:

grep a b c

A = $1 ect

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

$@

A

How to get all the parameters inputted at once

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

read -p PROMPT

A

Used to get input from the user as STDIN

How well did you know this?
1
Not at all
2
3
4
5
Perfectly