Shell scripting based questions

Assignment Help Data Structure & Algorithms
Reference no: EM1380648

Question1. Determine 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

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

cmd1 2>&1 >outfile

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

cmd1 2>&1 | cmd2

Question4. 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: EM1380648

Questions Cloud

How could an apparel company use second life to build : How could an apparel company use Second Life to build a digital dashboard to monitor virtual operations? based on the case Second Life: Succeeding in Virtual Times
Describe any constsaints on the ability of businesses : Describe any constsaints on the ability of businesses to respond to external factors.
Describe the difference between transactional and analytical : Describe the difference between transactional and analytical information, and determine which types Spotlight Analysis used to identify its 10 tribes." based on the case Political Micro-Targeting
Prioritize the various exit strategies and explain the order : Prioritize the various exit strategies and explain the order you established. Then, discuss at what point in the business each strategy should be executed along with your rationale.
Shell scripting based questions : Determine 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
What factors should jorge-marta and jocelyn consider : Jocelyn has little interest in sales or management but would like to invest a large sum of money that she has inherited from her aunt. What factors should Jorge, Marta, and Jocelyn consider in deciding which form of business organization to adopt.
Are the bankruptcy laws in the united states fair to small : Take a position and explain your reasons to the following statement: Are the bankruptcy laws in the United States fair to small business? If you could change the laws, state and justify the specific changes would you make. If you think the laws ar..
Analyze the different ways to evaluate economic performance : Analyze the different ways to evaluate economic performance and determine which provides the best assessment of the economy. Explain your rationale.
Question related to sequential files : In spite of the fact that sequential files lack direct targeted addressing of each of the records and fields, they are the most widely used.

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

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