OpE - Second Test

¡Supera tus tareas y exámenes ahora con Quizwiz!

A marco is a set of commands that automates a complex task consisting of multiple steps

True

Both vi and Emacs are examples of screen editors. True or False?

True

Commands that are executed in the order in which they appear use sequential logic

True

Issue the command necessary to store the results of the date command in a variable named TODAY

TODAY=`date`

The Bash shell is fully backward compatible with the Bourne shell.

True

a(n) line editor lets you work without one line or a group of lines in a file

True

to delete the current line in the vi editor, you would use dd

True

Assume that you are in command mode. Provide the following vi editor command sequence: Blank # 1) move to the fifth line of text, and Blank # 2) cut the entire line to place the text on the clipboard

5G dd

Enter the vi editor commandn that causes line number to appear

:set number

Line numbering can help you quickly identify specific lines that you want to edit in vi. Turn on line numbering

:set number

enter the vi editor command that causes lin

:set number

assume that you are editing the file myfile in the vi editor. save the file and exit

:x or :wq

You would use ____ to store information about the setup of the operating system that is not usually changed.

Configuration variables

In the Bash shell, which variable shows the filename containing commands to initialize the shell?

ENV

Issue the command to see the contents of a variable named CLASS.

Echo $CLASS

Identify the single-letter command to move the cursor to the last line on the screen in the vi editor

L

Which of the following statements makes a shell variable visible and accessible to shell scripts in the environment?

Export

screen-oriented commands require you to specify an exact location or address for a particular operation

False

you have placed the cursor in vi at the beginning of a line. While in the command mode, how can you delete the entire line?

type dd

Identify the key combination to view status information for your vi editing session

ctrl+g

Identify the key combination used in the vi editor to access the command line to execute several commands.

ctrl+z

You have created a variable named MY_VALUE. Issue the command to add MY_VALUE to your list of environment variables.

export MY_VALUE

the vi editor is often referred to as a(n) triad editor because it works in three modes

false

to copy text from the data file into the current file you are working on in vi, type :c data and press Enter. True or False

false

Which of the following is a statement that evaluates an arithmetic expression and stores the result in a shell variable?

let

Issue the command that will set the variable X equal to the value of the expression 8*3+4 (use the expression in your command, not the result of the expression).

let X=8*3+4

in the vi editor, do you enter all screen-oriented commands on the status line?

no

Identify the vi edtor command used to go forward one word

w

Identify the vi editor command to delete the current character (NOTE: it is not the delete or backspace keys).

x

In command mode in the vi editor, to delete a character, move to the character and type which of the following?

x

You can use which of the following commands in vi to copy a specified number of lines from a file and paste them on the clipboard?

yy

Which of the following operators means "not equal"?

!=

Which of the following is an expression that returns 0 if the value of the variable Y is nonzero and returns 1 if Y's value is 0?

!Y

Which of the following is not an example of an arithmetic operator?

#

which of the following commands save a file in vi and then exit? (choose all that apply)

#save :x !r,quit :wq

issue the command to execute a shell script named testscript located in your current working directory (assume no modification of your path environment variable)

./testscript

Which of the following are examples of arithmetic operators that can be used in a shell script?

/ ! ~

Enter the option that will suppress the line feed when using the echo command.

-n

Identify the repeat command to replicate the most recent changes you made to text in the vi editor

.

you have just entered four lines of text in the vi editor. Use the recent command to copy the four lines of text to the current location

.

When you define the variable R as R=(5*8)*(12+2) what is the value of R?

560

Identify the "go to" command to go to the beginning of the very first line in the vi editor.

1g

Identify the "go to" command to go to the begninning of the second line

2G

assume that you are at the beginning of the first line in the vi editor. Cut the first three lines from the document and store them in the buffer.

3dd

leave vi temporarily to view the current month's calendar using the cal command

:!cal

to leave vi temporarily to find the current date and time, you would perform which of the following operations in command mode?

:!date

Without exiting vi, temporarily execute the ls command to confirm that the file is saved

:!ls

You are in the vi editor and realize that you need to perform a file listing to check the name of a file. What command can you use from vi?

:!ls

in the vi editor, search for documents and replace it with text using a line-oriented command

:1,$s/documents/text/g

assume that you are in the vi editor. Change the word "tomorrow" to "today" only on the first five lines

:1,5s/tomorrow/today/g

From the vi editor, use a single command to delete lines five through seven

:5,7d

assume that you are viewing the help documentation from within the vi editor. leave the documentation

:q!

sometimes, you make changes in a document, but then decide not to save them. Assume then you have made a change to your document in the vi editor. Exit vi without saving your change

:q!

you are using vi to edit a configuration file, but decide to abort the editing session (you haven't yet saved anything). What do you type from command mode?

:q!

Identify the vi editor command to delete the text from the cursor to the end of the line

D

The Bash shell variable ps1 refers to the parent id of the shell

False

The grep command is useful when you want a shell program to automatically remove any temporary files that are created when the shell script runs.

False

Which of the following are used in looping logic?

For statement while statement

you have just a few minutes until you need to be in a meeting. However, you want to quickly go to the end of the last line in a file you are eating in vi so that you can add several quick reminders about additional entries for the file when you resume your work on it. What command or command sequence goes right to the end of the file.

G and then $

Identify the single-letter command to move the cursor to the upper-let corner of the screen in the vi editor.

H

To move the cursor within command mode in the vi editor, typing which of the following moves the cursor to the upper-left corner of the screen?

H

Use the vi editor single-letter command to go the first line displayed on the screen

H

One of the users that you support in an organization often needs to view hidden files, but has trouble remembering to type the ls -a command. He wonders why there is no command, such as hidden, that he can more easily remember. What do you suggest?

He should create an alias using the command alias hidden="ls -a".

Which of the following is the primary decision-making logic structure?

If statement

Do shell script programs run more quickly than compiled programs?

No

Issue the command needed to view a list of your environment variables.

Printenv

Without using the $PWD environment variable, issue the command that will add the current working directory to the PATH environment variable.

PATH=$PATH:.

You are developing several scripts in your current working directory, which is not your home directory and not in your default path. Which of the following commands can you use to add your current working directory to your path for the duration of your terminal window session?

PATH=$PATH:.

you have been editing a file in vi and decide to undo the most recent two actions you have entered. what should you type?

Press Esc, u, u

which of the following types of commands in vi executes at the location of the cursor?

Screen-oriented commands

____ are those you create for use with program commands in a script or at the command line.

Shell variables

after you create a new variable, stat1, from within a shell script, you find that the variable is not known to other shell scripts. what happens to the stat1 variable after you use the command so it is recognized by other shell scripts?

The variable is recognized as an environment variable

You are a newcomer to using vi and want to review its documentation before you edit a file. Which of the following are options in this situation? (choose all that apply)

Type man vi at the command line before you open vi open vi, press esc, type :!man vi, and press enter

Do usual mathematical precedence rules apply to arithmetic operators in shell scripts?

Yes

Your assistant has been working on a shell script, but when you test it, you cannot get it to run. What might be the problem?

Your assistant did not properly assign execute permission to enable you to run the script.

assume that you are in command mode. Provide the following vi editor command sequence: Blank #1) enter the "go to" command to move to the beginning of the first line, Blank # 2) move forward one word, and blank # 3) delete the current word.

blank 1: 1G Blank 2: w Blank 3: dw

Issue the command to create an alias that will execute the mv -i command any time time the user enters the mv command (this ensures that users are always prompted when moving a file).

alias mv="mv -i"

identify the vi editor command to go back one word

b

Which of the following types of statements allows you to match one of a set of choices and perform a specific action for that choice?

case statement

which of the following symbols precedes all line-oriented commands in the vi editor?

colon (:)

which of the follow is a process that is used to convert source code into an executable file?

compiling

Identify the vi editor command to delete the text from the cursor to the beginning of the line.

d0

Identify the vi editor command to cut the entire current line and store it on the clipboard

dd

In the vi editor, the ____________ command deleted the current line your working on in its entirety.

dd

delete the entire current line in the vi editor

dd

identify the vi editor command to cut the entire current line

dd

which of the following enables you to delete the current line in command mode of vi?

dd

Issue the command that is executed to end looping logic

done

You can set up _________________________ variables with initial values that you can change as needed to set desired characteristics of your login session

environment

identify the command used to access command mode in vi

escape (Esc)

If you use the Ctrl+z option to access the command line of your shell from vi, which of the following shell commands returns you to your edit session?

fg

Issue the command needed to end an if statement

fi

From the vi editor, paste the line on the clipboard into the document.

p

You have written a shell script called update that changes data in two files. You want to test the script, but you don't want to update any files. Which of the following commands enables you to do this?

sh -n update

_________ are files containing commands that are not typically compiled into machine code prior to running.

scripts

Grammatical mistakes that are located in a program are referred to as ____.

syntax errors

Which of the following commands initializes a terminal to respond to a setting that the user chooses?

tput command

Which of the following will move the cursor to row 4 and column 8?

tput cup 4 8

The ____________________ command is useful when you want a shell program to automatically remove any temporary files that are created when the shell script is run

trap

how can you display the status line in vi

use the ctrl+g from command mode

open the file myfile in the vi editor

vi myfile


Conjuntos de estudio relacionados

PrepU chapter 47 lipid-lowering Agents

View Set

Life Insurance Exam questions IDAHO

View Set

Chapter 11: Voting, Campaigns, and Elections

View Set