1) You are editing an existing file in vi. The cursor is at the beginning of the
ID: 3826867 • Letter: 1
Question
1) You are editing an existing file in vi. The cursor is at the beginning of the first line, in Command mode. You want to skip to the end of the second line, add the word "frostwolf", and then write the file to disk.
Which of the following command sequences would you use?
2)Which command saves interactive input to a variable named "userInput"?
3)What conditions must be true for the echo statement to be executed in the script below?
#!/bin/bash
if [ -e $1 ] && [ -x $1 ]
then
echo This file is useful.
fi
4)Read the following script and select the correct ouput:
#!/bin/bash
a=$((4+ 5))
b=$((3+5))
if [$a -gt $b]
then
echo A is greater than B
else
echo A is not greater than B
fi
The brown fox jumps
over the dog.
The dog is asleep.
The fox is crafty.
#! /usr/bin/awk -f
BEGIN {
print "20"<"9" ? "true":"false"
}
I want the following awk script to output the value of the indicated variable. What command should I use?
#! /usr/bin/awk -f
BEGIN {
two=2;
two++;
}
Explanation / Answer
6)What will the following awk script output?
false, because 20 is greter than 9.
I want the following awk script to output the value of the indicated variable. What command should I use?
print two
8)Which of the following deletes all of the blank lines from the given input file?
sed -e '/^$/d' file
9)Which of the following commands displays only the top 5 lines of file?
sed -n -e '1,5 p' file
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.