Suppose that you have an application whose behavior depends on the environment variable BAR. Which of the following command lines may be used in a bash shell to configure the application?

Linux Admin

Quiz
•
Other
•
Professional Development
•
Hard
Used 8+ times
FREE Resource
6 questions
Show all answers
1.
MULTIPLE SELECT QUESTION
30 sec • 1 pt
export $BAR=baz; echo $BAR
set BAR=baz
BAR=baz ; export BAR
echo BAR=baz
declare -x BAR=baz
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following commands can be used to assure that a file 'myfile' exists?
cp myfile /dev/null
touch myfile
create myfile
mkfile myfile
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following command lines can be used to convert a file containing DOS-style CR-LF line endings into Unix-style LF line endings? Assume for this question that the DOS-style file is called 'dosfile', and we want the modified contents in 'unixfile'
sed 's/\r//' dosfile > unixfile
tr -d '\r' < dosfile > unixfile
dos2unix dosfile unixfile
strip '\r' < dosfile > unixfile
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Suppose for this question that you have a file called 'wordlist' that contains a number of words, one per line. You would like to produce an ad-hoc report that contains a numbered list of the first five words, according to alphabetical order. Which of the following command lines can be used to produce this report to the console?
sort wordlist | nl | head -5
split -1 wordlist ; cat xa? | head -5
nl wordlist | sort | sed '/^ [^12345]/d'
nl wordlist | sort | head -5
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
The command 'ps -A' displays an ordered list of all running processes, with the right-justifed process ID in the first space-separated field. Suppose you would like to display to screen a list of the five most recently launched processes (those with the highest process IDs). Which of the following
commands will display the desired items?
ps -A | tail -5 | cut -f 1 -d " "
ps -A | tail -5 | sed 's/[ ]*[0-9]*//'
ps -A | head -5 | nl
ps -A | tac | head -5 | cut -b 0-5
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Suppose that a file 'names' contains a list of names in the form, "firstname lastname", one per line. These names are unsorted, and you would like them sorted by lastname; however, the format of names on each line should remain the same. Which ONE of the following commands will NOT output an appropriately sorted list of names to the console?
cut -f 2 -d " " names | paste names - | sort -k 3 | cut -f 1
sort -k 2 names
sed 's/\(\w*\) \(\w*\)/\2\1\2/' names | sort | cut -f2-3 -d" "
cut -f 2 -d " " names | sort
cut -f 2 -d " " names | paste - names | sort | cut -f 2
Similar Resources on Wayground
10 questions
Tom Holland Quiz

Quiz
•
5th Grade - Professio...
10 questions
Refreshment PMK YIA

Quiz
•
Professional Development
10 questions
5 Names Slow A

Quiz
•
Professional Development
10 questions
Suspension

Quiz
•
Professional Development
11 questions
Attack on Titan Quiz

Quiz
•
KG - Professional Dev...
10 questions
akatsuki names

Quiz
•
2nd Grade - Professio...
10 questions
Kuis Valorant

Quiz
•
Professional Development
7 questions
Sweets

Quiz
•
KG - Professional Dev...
Popular Resources on Wayground
25 questions
Equations of Circles

Quiz
•
10th - 11th Grade
30 questions
Week 5 Memory Builder 1 (Multiplication and Division Facts)

Quiz
•
9th Grade
33 questions
Unit 3 Summative - Summer School: Immune System

Quiz
•
10th Grade
10 questions
Writing and Identifying Ratios Practice

Quiz
•
5th - 6th Grade
36 questions
Prime and Composite Numbers

Quiz
•
5th Grade
14 questions
Exterior and Interior angles of Polygons

Quiz
•
8th Grade
37 questions
Camp Re-cap Week 1 (no regression)

Quiz
•
9th - 12th Grade
46 questions
Biology Semester 1 Review

Quiz
•
10th Grade