ADV PROG DAY 3 Flashcards

1
Q

When used, returns all the values in the array as a single value. The * can be replaced with an index number to return the value in that element.

A

${name[*]}

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

When used,returns the number of elements in the array. The * can be replaced with an index number to return the length of that value.

A

${#name[*]}

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

Stores name of command used to call current program.

A

$0

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

Stores number of arguments passed to script or function.

A

$#

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

References all arguments passed to script or function.

A

$*

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

Stores first nine arguments in incrementing variables passed to script or function.

A

$1, $2, $3, …$9

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

Stores exit status of previous command.

A

$?

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

For Bash:

Substitutes variables and escaped characters with their actual values.

A

Double Quotes “”

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

For Bash:

Makes everything literal so the values of variables are not substituted.

A

Single Quotes ‘’

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

For Bash:

Used to capture the output of a command. A command enclosed in back quotes is replaced by the STDOUT of that command. Shell variable values are substituted within back quotes.

A

Back Quotes ` `

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

A script reads a line from the keyboard .

assigns the contents of the input to the variable listed. The following example shows two input styles.

A

read command

–p allows a double quoted prompt.

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

sorts the contents of a text file, line by line.

A

sort command

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

provides the ability to evaluate a wide range of arithmetic expressions. It evaluates its arguments as expressions and returns the result.

The spacing in an expression is critical.

A

expr tool

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