Does the standard output of this script get sent to stdout

Assignment Help Programming Languages
Reference no: EM13947998

1. Will the following only print the text "I FOUND A MATCH" to standard output when the grep is successful?

if grep "mrichard" /etc/passwd; then echo "I FOUND A MATCH"; fi

2. Does the following command send both standard output and standard error to the same file for the command cmd1?

cmd1 2>&1 >outfile

3. Does cmd2 receive both the standard error and standard output of cmd1 as standard input?

cmd1 2>&1 | cmd2

4. Will the script below always print out the text 'They are the same' assuming the script ran under the Bourne shell?

#!/bin/sh
infile=${0}

if [ ! -s "$infile" ]
then
exit 1
fi

linecnt=`wc -l $infile | while read cnt rest
do
echo $cnt
done`

mycnt=0
while read line
do
mycnt=`expr $mycnt + 1`
done < $infile

if [ $linecnt -eq $mycnt ]
then
echo They are the same
else
echo They are different.
fi

5. Does the standard output of this script get sent to STDOUT?

#!/bin/sh

exec 4>&1
exec 1>&2
exec 2>&4
exec 4>&-
echo Hello
echo More text

6. Is the visible output of this script, the text 'Hello'?

#!/bin/sh

(
exec 4>&2
exec 2>&1
exec 1>&4
exec 4>&-
echo Hello
) 2> /dev/null

Reference no: EM13947998

Questions Cloud

What are the six incentives or causes for ecoefficiency : What are the six incentives, or causes, for ecoefficiency? What is an environmental cost? What are the four categories of environmental costs? Define each category.
Application that requires a yield strength : It is necessary to select a metal alloy for an application that requires a yield strength of at least 310 MPa (45,000 psi) while main- taining a minimum ductility (%EL) of 27%. If the metal may be cold worked, decide which of the following are can..
How an aeroplane can move upward how plane can remain : How an aeroplane can move upward? How plane can remain equilibrium in space? How plane can change its altitude? Why sometimes bumping occurs? Why sometimes plane becomes inclining in space?
What is the stock standard deviation : What is the stock's expected return? What is the stock's standard deviation? What is the stock's coefficient of variation?
Does the standard output of this script get sent to stdout : Is the visible output of this script, the text 'Hello'?
What are the four processes that are useful for increasing : What are the four processes that are useful for increasing the likelihood that information will be transferred into long-term memory?
Coordination needed to manage supply chains : Watch the B2E Case Study 9 scenario "Production Disruption." Identify the ethical issues that may be unique to the field of Operations Management in this company and the ethical issues relating to corporate responsibility. Discuss ways to success..
Explain the hybridization of boron in the molecule : Create a similar energy level diagram to explain the hybridization of boron in the molecule boron trifluoride, BF3, which exhibits trigonal-planar molecular geometry and bond angles of 120°.
Create a file from the keyboard called university : Create a directory within "your last name" called BLACKSBURG. Do this from your home directory

Reviews

Write a Review

Programming Languages Questions & Answers

  Create program which lists total points scored

Create program which lists total points scored for each of 30 classrooms. Include invalid input check if a proper room number is not entered.

  Write a perl program

Write perl program which will run on my system and will start another perl program on another linux system. The main program should wait for linux perl program to complete its work and send the result to my main perl program.

  Design a gui that runs a simulink model

Use a numerical intergration to determine the distance x the airplane travels as a function of time. Make a plot of x versus time. Design a GUI that runs a Simulink model to solve questions (a) and (b).

  Computer sales and repair store system

It is required to design a relational database system for a "realistic" application

  What do you meant by abstract keyword

What does the abstract keyword do and what are generics as they relate to the built in linked list class? Why do we need them?

  Write a method named maxelement

Write a method named maxElement, which returns the largest value in an array that is passed as an argument. The method should use recursion to find the largest element. Demonstrate the method in a program.

  Write at least two test cases to check for errors

Write a program that accepts a given number an input from the user and prints prime numbers up to that number.

  Write code for largest value of parking tickets

Without using any additional variables, and without changing the values of ndays or the elements of the parkingTickets array, write some code that results in mostTickets containing the largest value found in parkingTickets .

  Sequence of statements to find first comma in string line

Write a sequence of statements that finds first comma in String line , and assigns to variable clause portion of line up to, but not including the comma.

  1 microsoft is developing a new program and they want to

1. microsoft is developing a new program and they want to identify the break-even point.their fixed cost is 72000 while

  There is two part in this assignment1-discussion1-what does

there is two part in this assignment1-discussion1-what does ethics have to do with recruiting and please define ethics?

  Explain a functioning design in unity game engine

Need a functioning design in Unity Game Engine. The rough draft only needs the game level scene, skybox, the terrain (shaped, textured, with trees and grass), the buildings (with functioning doors), the avatar, and being able to "pick up" the two ..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd