CH 7 Review Questions

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Which of the following characters are placed right after a function name when you create a shell function?

()

Which of the following are examples of Boolean operators used with the test command? (Choose all that apply.)

-a for a logical AND -o for a logical OR

You use the same five shell functions every day and are looking for a way to ensure they are available as soon as you log into your account.What can you do?

Load them via your login script

Your shell script, called filetests, contains several functions used to run tests on files,such as to determine if a file is empty or has the correct permissions.Which of the following is/are true about .filetests? (Choose all that apply.)

You can load the file's functions into memory by entering .filetests This is a hidden file

When working on the script in Question 15, which of the following should you consider?

input validation

What does a down arrow represent in a flow chart?

process flow

Each month your business manually deletes specific records for employees who have left the company.You have been asked to write a script to automate this process.Which of the following commands works well for deleting records in a file?

sed -d

When you create a shell function from the command line, what character do you enter at the first > prompt just after you declare the function's name?

{

Which of the following script statements accomplishes the same thing as the statement: while [ "$part" != "alternator" ] ; do ? (Choose all that apply.)

while test $part != "alternator" ; do

Which of the following statements enables you to determine if the variable, called value, is less than 750?

test $value - lt 750

You have recently met with your company's budget committee about creating a script to for producing the same budget reports at the end of each month. Because this is an important undertaking you've started by creating a flowchart.What step should you take next?

write pseudocode before you create the actual script

Your company has assigned you to revise 22 scripts. Since you use the vi editor, how can you set it to automatically display lines as numbered so it is easier for you towork on these revisions?

Create the .exrc file in your home directory so this file contains the line :set number

The script you are creating takes data input to use for updating a file. Before taking the data input, you want the script to verify that the file to be updated, called clients,exists and that the script user has permission to write to that file. Which of the following statements enables you to do this?

test -w clients

Create a statement that enables you to determine if the file /source/results is newer

test/source/results -nt /data/results test/source/results -nt /data/results ; echo $?

Create a simple function that determines if the string variable, text, contains no characters (is of zero length).

stringtest() { test -z $text echo $? }

What symbol is typically used at the start and end of a flowchart?

terminator

Some Linux systems use the script to perform the same actions each time a user logs out of her account.

.bash_logout

In your organization everyone uses the Bash shell in Red Hat Enterprise Linux andall users use the same aliases and shell functions. In what file or files can the systemadministrator place these aliases and functions so they are available to all users? (Choose all that apply.)

/etc/.bashrc /etc/profile

In which of the following files would a system administrator set the default shell used by your account?

/etc/password

When you enter echo $CLR your screen clears very quickly.Which of the following commands must you have entered previously to enable use of echo $CLR to clear the screen?

CLR = `clear`

You have been asked to write a script for use by the faculty at the engineering school at your college.The script you write uses the Bash shell, but some faculty members often use a different shell in their work. How can you best ensure that the Bash shell is invoked when this script is run?

Enter the line # !/bin/bash as the first line in the script

What is an exit status and with what command is it used?

The exit status is used with the test command and is a value that represents the value of a test, such a value of 0 to show that the results of the test are true or a value of 1 to show the test results are false.

When you enter test -d tmp ; echo $?, you see a 0 displayed on the screen.What does this mean?

The tmp directory exists

You have a specialized data file, called customers, in which the fields in the file are separated by the character ^.You want to view this file with a colon between the fields before you convert it to remove the ^ characters and insert colons.Which of the following commands enables you to view the file in this way?

cat customers | tr "^" "."

Which of the following are examples of symbols you might use in a flowchart?(Choose all that apply.)

decision document magnetic disk data


Ensembles d'études connexes

C459 Intro to Probability and Statistics

View Set

Chapter 29: PrepU - Nursing Assessment: Endocrine Function

View Set

Ch 2 Characteristics of Real Property

View Set

Chapter 4 Section 2 microeconomics

View Set

Fjalë të panjohura, Libri i Medinës 1 - Mësimi 1-23

View Set

Army E5/E6 Promotion Board Study Questions

View Set

JATC homework code practice test

View Set

public speaking chapter 11, Chapter 11 Assignment, Speech ch 11

View Set