Final Exam Ch. 7Review

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

9. Which of the following operators reserves the meaning of a test statement?

!

8. Which of the following variables could access the value "/etc" within the sample shell script, if the sample shell script was executed using the bash sample /var /etc /bin command?

$2

Which of the following can be used for comparing values within an if statement? (Choose two.)

-lt; =

3. Which of the following files is always executed immediately after any user logs in to a Linux system and receives a BASH shell?

/etc/profile

How many times will the following loop execute as part of a script:

0

Which of the following would be the result of running the command seq 7?

1 through 7 being displayed one number per line.

Which of the following will take output from a command and append it to the end of a file?

>>

19. How do you indicate a comment line in a shell script?

Begin the line with #.

Which of the following commands can be used to create a BASH variable name CREATOR with the value of Torvalds?

CREATOR="Torvalds"

4. Because stderr and stdout represent the results of a command and stdin represent the input required for a command, only stderr and stdout can be redirected to/from a file. True or False?

False

12. What does &> accomplish when entered on the command line after a command?

It redirects both stderr and stdout to the same location.

2. Consider the following shell script: echo -e "What is your favorite color? --> \c"

The answer is not red nor blue.

11. The sed and awk commands are filter commands commonly used to format data within a pipe. True or False?

True

13. A for construct is a loop construct that processes a specified list of objects. As a result, it is executed as long as there are remaining objects to process. True or False?

True

7. Both aliases and functions can be used to store commands that can be executed, but functions can also accept positional parameters. True or False?

True

1. You have redirected stderr to a file called Errors. You view the contents of this file afterward and notice that there are six error messages. After repeating the procedure, you notice that there are only two error messages in this file. Why?

You did not append the stderr to the Error file, and, as a result, it was overwritten when the command was run a second time.

Which of the following results would be created by the command sequence: echo 'apple banana carrot dog elephant' | while read a b c; do echo result: $c $b $a; done

carrot dog elephant banana apple

Which of the following files can you add filenames to so that the git add * command will not stage them?

gitignore

Which of the following commands will display the contents of the /etc/passwd file in alphanumerical order?

sort /etc/passwd

17. What would be the effect of using the alias command to make an alias for the date command named cat in honor of your favorite pet?

When you use the cat command at the command prompt with the intention of viewing a text file, the date appears instead.

Which command can be used to create a new command that will monitor the contents of auth.log as they get added to the file?

alias showauth='tail -f /var/log/auth.log'

14. 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"

You have just created a variable named CREATOR. Which of the following commands will display the contents of the variable to standard output?

echo $CREATOR

5. Before a user-defined variable can be used by processes that run in subshells, that variable must be .

exported

6. Every if construct begins with if and must be terminated with .

fi

Which of the following commands should you use to specify that you want to use Git for version tracking on them?

git add

15. Which construct can be used in a shell script to read stdin and place it in a variable?

read

Which of the following commands will count the number of lines in a file named data.csv?

wc -l data.csv


संबंधित स्टडी सेट्स

CHAPTER 6 THE THREE ENERGY SYSTEMS WORKING TOGETHER TO PRODUCE ATP

View Set

chapter 16 - disability income insurance

View Set

CH_11_Skull and Cranial Bones (SELF-TEST)

View Set

pearson elemental geosystems ch 10

View Set

Microeconomics Exam chapters 6-8

View Set

Chemistry practical: Concentration and preparation of solutions

View Set