Week 7 Comprehension Flashcards
Which command will display the following information?
The number of different shells being used on a Linux system
$ cat /etc/passwd | cut -d: -f7 | uniq | sort | wc -l
$ cat /etc/passwd | cut -d: -f7 | wc -l | sort | uniq
$ cat /etc/passwd | cut -d: -f7 | sort | wc -l | uniq
$ cat /etc/passwd | cut -d: -f7 | sort | uniq | wc -l
$ cat /etc/passwd | cut -d: -f7 | sort | uniq | wc -l
Find the match.
stderr()
stdout()
stdin()
|
0
1
Pipe
2
stderr() =2
stdout() =1
stdin() =0
| = Pipe
Which numeric variable test expressions work? (Select two)
A (($A == $B))
B ((! $A -eq $D))
C (($A != $C))
D ((! $A = $D))
A. (($A == $B))
C. (($A != $C))
! /bin/bash
What will be displayed? Assume the script has the execution bit set.
$ cat myscript.sh
echo “$0 $@ $1 $2”
- Nothing
- Hello World!
- ./myscript.sh Hello World!
- ./myscript.sh Hello World! Hello World!
- ./myscript.sh Hello World! Hello World!
Which commands will work? (Select two)
$ ls > file1
$ file1 > file2
$ wc < file1
$ wc | file1
$ ls > file1
$ wc < file1
What is Git?
- Another name for Gigabit
- Version control software
- Configuration management software
- Open source malware
- Version control software
What does export a variable mean?
- Allow the variable to become accessible by child processes
- Allow the variable to become accessible by parent process
- Send the variable to a file
- Send the variable to foreign countries
-Allow the variable to become accessible by child processes
Suppose file1 exists but dir1 does not. Which command will write stdout and stderr to the same file? (Select two)
$ cat file1 dir1 2>file
$ cat file1 dir1 >file 2>&1
$ cat file1 dir1 2>&1 >file
$ cat file1 dir1 &>file
$ cat file1 dir1 >file 2>&1
$ cat file1 dir1 &>file
Which commands will work? (Select two)
$ ls > file1
$ file1 > file2
$ wc < file1
$ wc | file1
$ ls > file1
$ wc < file1
! /bin/bash
What will be displayed? Assume the script has the execution bit set.
$ cat myscript.sh
function print_positional_params () {
echo “$3 $1 $2”
}
print_positional_params “$3” “$2” “$1”
- one two three
- one three two
- two three two
- three one two
- one three two