3.3 Turning Commands into a Script Flashcards

1
Q

Scripting

numerical comparison

not equal to

A

-ne

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

Scripting

numerical comparison

greater than

A

-gt

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

Scripting

numerical comparison

greater than or equal to

A

-ge

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

Scripting

numerical comparison

less than

A

-lt

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

Scripting

numerical comparison

less than or equal to

A

-le

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

Scripting

a simple script that will check if exactly two arguments are passed. If so, print the
arguments in reverse order.

A

if [ $1 == $number ]
then
echo “True!”
fi

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

Scripting

arguments

positional

A

$1, $2, … $9

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

Scripting

arguments

contains number of args passed to script

A

$#

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

Scripting

arguments

contains directories that have executable used by the system

A

$PATH

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

Scripting

all scripts begin with this character that defines the path to the interpreter

A

shebang

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

Scripting

remove first element of an array

A

shift

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

Scripting

contain exit code of last command executed

A

$?

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

Scripting

contain all args passed to the script as an array

A

$@, $*

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