Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

Students also viewed these Databases questions