Question: QUESTION 1 The following command prints out the first character of the text stored in the shell variable MYVAR: echo $MYVAR | sed -e 's/.*(.)$/1/'

QUESTION 1

The following command prints out the first character of the text stored in the shell variable MYVAR:
echo "$MYVAR" | sed -e 's/.*\(.\)$/\1/'

True

False

20 points

QUESTION 2

Choose the correct output for each of the echo statements given the following:

STREET="1 University Ave"
CITY="Lowell"
STATE="MA"
ADDRESS="$STREET NOTE: there should be a new line after the $STREET
$CITY, $STATE"
- A. B. C.

echo '$ADDRESS'

- A. B. C.

echo "$ADDRESS"

- A. B. C.

echo $ADDRESS

A.

$ADDRESS

B.
Prints the address as a single line 1 University Ave Lowell, MA
C.
1 University Ave this the first line
Lowell, MA This is the second line

30 points

QUESTION 3

Given the following shell variable assignments:

STREET="59 Lowes Way"

CITY="Lowell"

STATE="MA" 
ADDRESS='$STREET
$CITY, $STATE'

The command,

echo "$ADDRESS"

Will display the following:

59 Lowes Way

Lowell, MA

 
 

True

False

10 points

QUESTION 4

If the shell variable TESTME was defined as follows,
TESTME="0123456789"

The following command would echo 11

echo "$TESTME" | wc -c

True

False

20 points

QUESTION 5

Given the following commands:

P1="Hello world I am here"
P1=`echo "$P1" | tr '\t' ' ' | sed -e 's/[ ]//g'`
echo "$P1"

The result of the last echo statement will be
Hello world I am here

True

False

20 points

Click Save and Submit to save and submit. Click Save All Answers to save all answers.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!