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

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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