shell scripting Flashcards

1
Q

$x

A

accessing a variable

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

‘$x’ vs. “$x”

A

string literal vs. variable

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

special characters:

A

” , $, `, “, *

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

read

A

reads input; by default, splits the input into words, considering <space>, <tab>, and <newline> characters as word delimiters</newline></tab></space>

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

read -s

A

suppress the printout of the input

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

read -p

A

specify prompt message

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

read -t N

A

timeout after N seconds

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

read -n N

A

read exactly N characters

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

:-

A

replace a empty variable with a default value

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

:=

A

assign default values to empty variables

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

-n <string></string>

A

length non-zero

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

-z <string></string>

A

length zero

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

<string>
</string>

A

string non-zero

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

-eq

A

is equal

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

-neq

A

not equal

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

-gt

A

greater than

17
Q

-ge

A

greater than or even

18
Q

-lt

A

lesser than

19
Q

-le

A

lesser than or even

20
Q

-e

21
Q

-f

A

exists and is a regular file

22
Q

-d

A

exists and is in directory

23
Q

-s

A

exists and its size is larger than zero

24
Q

-nt

A

newer than

25
-ot
older than
26
continue
skips the rest in the current iteration and starts a new iteration
27
$0
name of the script
28
$1-$9
argument
29
$@
all arguments
30
$#
number of arguments
31
$?
return code of the previous command
32
$$
PID of the current command
33
!!
entire last command with arguments
34
$_
last argument of last command
35