Write a shell script

Assignment Help Basic Computer Science
Reference no: EM13654564

Write a shell script, named grepdir.sh, that searches for a pattern in a directory, and all of its subdirectories. The starting directory is the first argument, the pattern is the second parameter, and the options for grep are all succeeding parameter(s). Options will start with a hyphen. The script should produce a usage statement if the script is misused.
[davis@lect1 private]$ ls
cpdirs.sh grepdir.sh makemake.sh temp temp2 temp3 uncomp.sh [davis@lect1 private]$ grepdir.sh cpdirs.sh bin
usage: grepdir.sh directory pattern [-grep option]*
[davis@lect1 private]$ grepdir.sh .
usage: grepdir.sh directory pattern [-grep option]*
[davis@lect1 private]$ grepdir.sh cpdirs.sh bin
usage: grepdir.sh directory pattern [-grep option]*
[davis@lect1 private]$ grepdir.sh .
usage: grepdir.sh directory pattern [-grep option]*
[davis@lect1 private]$ grepdir.sh . bin
#! /bin/bash
#! /bin/bash
#! /bin/bash
bin in file 1
#! /pkg/bin/bash
[davis@lect1 private]$ grepdir.sh . bin -l
./grepdir.sh
./cpdirs.sh
./makemake.sh
./temp2/1
./uncomp.sh
[davis@lect1 private]$ grepdir.sh . BIN -l
[davis@lect1 private]$ grepdir.sh . BIN -li
./grepdir.sh
./cpdirs.sh
./makemake.sh
./temp2/1
./uncomp.sh
[davis@lect1 private]$ grepdir.sh . BIN li
usage: grepdir.sh directory pattern [-grep option]*
[davis@lect1 private]$ grepdir.sh . BIN -n -i
1:#! /bin/bash
1:#! /bin/bash
1:#! /bin/bash
1:bin in file 1
1:#! /pkg/bin/bash
[davis@lect1 private]mce_markernbsp; 

Reference no: EM13654564

Questions Cloud

What is the magnetic field in that region of space : A cosmic-ray proton in interstellar space has an energy of 16.5 MeV and executes acircular orbit having a radius equal to that of Earth revolving around the Sun (1.50*1011 m). What is the magnetic field in that region of space?
Examples of immigrants being taken advantage of : Felicia works for wealthy white people cleaning their homes; Hector and Diego do construction work off the books. Are these genuine opportunities, or examples of immigrants being taken advantage of?
Obtain what is the kinetic energy of rotation : Each of the three helicopter rotor blades shown in the figureis 5.20 m long and has a mass of 240 kg. What is the kinetic energy of rotation
Compass is placed between plates of fully charged capacitor : if a magnetic compass is placed between the plates of a fully charged capacitor, why wouldn't the compass will align itself along the electric field lines.. ... please explain in detail.
Write a shell script : Write a shell script, named grepdir.sh, that searches for a pattern in a directory, and all of its subdirectories.
Tall poppy syndrome : "Tall poppy syndrome" or "crab mentality" is often pointed out by observers of minority cultures, when a member of the community achieves, or has goals, outside of the average and is dragged down or derided by others. Do you see this at work in an..
Explain what is the molar heat of solution for the salt : A 1.0g sample of an unknown salt (molar mass = 40 g/mol) is added to 75.0mL of water. The temperature of the water rises 32oC after the salt is added, what is the molar heat of solution for the salt
Determine what is the peak electric field : A peak intensity of an EM wave is 3.40x10^7 W/m^2. if the peak magnetic field is 2.87x10^-6 T, what is the peak electric field
Demonstrate the changes in american life : The story shows the before and after of the revolution. What are some of the before and after changes displayed through out the story that demonstrate the changes in American life caused by 1776?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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