Positional Parameters Flashcards

1
Q

How do you list the number of arguments in a command line?

A

echo $#

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

How do you get the name or path of a command?

A

echo $0

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

How do you get all of the command line arguments?

A

echo $*

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

How do you get the status of the last command?

A

$?

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

How do you print the current process ID?

A

echo $$

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

What is $1, $2?

A

$1 is the first argument after the command name and $2 is the second argument.

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

How do you list ssh supported escape sequences?

A

echo ~?

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

What is $?

A

Status of the previous command.

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