Mod 07 Working with the Shell

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

Which of the following characters can be entered at the beginning of a line in a shell script to ensure that line is recognized as a comment line only?

#

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

-lt =

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 would be the results of running the command seq 7?

1 through 7 being displayed one number per line.

Which of the following represents stderr at the command line when used for redirection?

2

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

>>

Which of the following is the common escape sequence to display a horizontal tab using the echo command?

\t

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 varlogauth.log'

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 commands will send the output of the cat command to the grep command to be filtered?

cat etcpasswd | grep jsmith

Marisa executes a shell script using the following syntax: ./script1.sh dog cat rabbit. What line can be used within the script to print the value "cat"?

echo $2

Which of the following commands will display the exit status of the last command used in the BASH shell?

echo $?

When writing shell scripts and using a case statement to determine whether a set of code should be executed, what is the proper syntax to end the case construct?

esac

Which of the following BASH environment files is executed first when a user opens a new terminal?

etcprofile

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

export CREATOR=Torvalds

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

git add

Which command can be used to download an updated copy of the main branch from the original Git repository?

git pull origin main

Which of the following will look at the etcpasswd file for any lines containing the word root and display them out to the screen while simultaneously writing the results to a file?

grep root etcpasswd | tee root.txt

Which of the following constructs can be used in a shell script to determine whether two values are equal and if so run another set of commands?

if

Which of the following commands will display the output of a file while also displaying a line number at the left side of each line for the etc|passwd

nl etcpasswd

Which of the following commands will display the contents of the etcpasswd file in alphanumerical order?

sort etcpasswd

Which of the following is a valid method of running a script named myscript.sh that gives the current user execute permission? (Choose all that apply.)

source myscript.sh bash myscript.sh myscript.sh

Levi wants to run 5 commands sequentially but does not want to create a shell script. He knows that each command is going to take approximately 20 minutes to run individually. However, he would like to go to lunch 15 minutes from now. He knows that he can type all of the commands on the same line and separate them with a certain character to run them sequentially. What can he type after each command to have them run one after the next without requiring further input from him, as well as ensure that if one of the commands encounters an error, the remaining commands are not run?

two ampersands (&&)

An alias has previously been created named showauth. Which of the following commands can be used to remove that alias?

unalias showauth

How many times will the following loop execute as part of a script:#!binbashCOUNTER=0while [ $COUNTER -lt 7 ]do echo "hello world"done

until Ctrl+c is used to terminate it

Scott has recently set the Z shell as his current shell and wishes to enable some additional Z shell options. What command should Scott run to do this?

vi ~.zshrc

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

wc -l data.csv

Using the syntax below, what command will create directories named one, two, and three? echo one two three | ___________ mkdir

xargs


Conjuntos de estudio relacionados

cornett financial accounting quiz five and six

View Set

Exam Prem CompTIA A+ 220-1102 Practice - Set A Part 1

View Set

Poetic Devices- Match Term to Examples

View Set

hockenberry -Cerebral (intracranial regulation)

View Set

Lesson One: OSI anD TCP/IP Modle

View Set

Traditional Hawaiian Metaphors Worksheet

View Set