Module 7 Flashcards
What is Git?
- Another name for Gigabit
- Version control software
- Configuration management software
- Open source malware
- Version control software
Which numeric variable test expressions work? (Select two)
- (($A == $B))
- ((! $A -eq $D))
- (($A != $C))
- ((! $A = $D))
- (($A == $B))
- (($A != $C))
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
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
! /bin/bash
What will be displayed? Assume the script has the execution bit set.
$ cat myscript.sh
echo “$0 $@ $1 $2”
$ ./myscript.sh Hello World!
- Nothing
- Hello World!
- ./myscript.sh Hello World!
- ./myscript.sh Hello World! Hello World!
- ./myscript.sh Hello World! Hello World!
Which outputs are a result of the following command? (Choose all that apply) Assume each original name started with a capitalized letter followed by lower-case letters.
$ tr [h-z][H-Z] < names
- DONaLd DUcK
- MIcKeY MOUSe
- WaLT DiSNey
- WiNNie THe POOH
- DONaLd DUcK
- MIcKeY MOUSe
What will be displayed? Assume the script has the execution bit set.
$ cat myscript.sh
#! /bin/bash function print_positional_params () { echo "$3 $1 $2" } print_positional_params "$3" "$2" "$1" #./myscript.sh one two three
- one two three
- one three two
- two three two
- three one two
- one three two
Find the match.
[ A = B ]
[ A -eq B ]
[ -d A ]
[ -f A ]
Strings A is equal to String B
A is numerically equal to B
A is a directory that exists
A is a file that exists
[ A = B ] Strings A is equal to String B
[ A -eq B ] A is numerically equal to B
[ -d A ] A is a directory that exists
[ -f A ] A is a file that exists
Which command will display the following information?
The number of users who use BASH shell
- $ cat /etc/passwd | cut -d: -f7 | sort | grep bash
- $ cat /etc/passwd | cut -d: -f7 | sort | wc -l
- $ cat /etc/passwd | cut -d: -f7 | wc -l | grep bash
- $ cat /etc/passwd | cut -d: -f7 | grep bash | wc -l
- $ cat /etc/passwd | cut -d: -f7 | grep bash | wc -l
How do you run a shell script? (Select three)
Assume the file has the execute bit set . PATH is not set to the current directory.
- myscript.sh
- ./myscript.sh
- . ./myscript.sh
- source ./myscript.sh
- ./myscript.sh
- . ./myscript.sh
- source ./myscript.sh
Before a user-defined variable can be used by processes that run in subshells, that variable must be __________.
- imported
- Falsevalidated by running the env command
- exported
- redirected to the BASH shell
- exported
Which of the following will display the message welcome home if the cd /home/user1 command is successfully executed?
- cd /home/user1 && echo “welcome home”
- cat “welcome home” || cd /home/user1
- cd /home/user1 || cat “welcome home”
- echo “welcome home” && cd /home/user1
- cd /home/user1 && echo “welcome home”
How do you indicate a comment line in a shell script?
- There are no comment lines in a shell script.
- Begin the line with #!.
- Begin the line with !.
- Begin the line with #.
- Begin the line with #.
Consider the following shell script: echo -e “What is your favorite color?--> \c” read REPLY if [ $REPLY = “red” -o $REPLY = “blue” ] then echo “The answer is red or blue.” else echo “The answer is not red nor blue.” fi
What would be displayed if a user executes this shell script and answers Blue when prompted?
- The answer is red or blue.
- The answer is not red nor blue.
- The code would cause an error.
- The answer is red or blue. The answer is not red nor blue.
- The answer is not red nor blue.
The sed and awk commands are filter commands commonly used to format data within a pipe. True or False?
True
False
- True