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

  Explaining origins or genesis of wireless networking

Explain origins/genesis of wireless networking.

  Calculate the relative return on investment

Calculate the relative return on investment if I want to invest in a company

  Lfsr produces a sequence with a period of length

An n-stage LFSR produces a sequence with a period of length at most 2n - 1, but the register has n bits and thus may assume 2n values. Why can the length of the period never be 2n? Which register value is excluded from the cycle, and why?

  Calculates how many km had went a man

Write a program that calculates how many km had went a man and how far he was from the initial point .

  How system access big date to maximum in usage?

How system access big date to maximium in usage?

  What normalization is used for and why

What normalization is used for and why

  Write down a 3- to 5-page paper describing marketing plan

mcbride marketing paperresource virtual organization for mcbride financial servicesmcbride financial services wants to

  Compute net present value and return on investment

Compute net present value (NPV) and return on investment (ROI) and present break-even analysis (BEA). Suppose discount rate of 12 percent and five-year time horizon.

  What other patient data should be included in your database

In a larger category of "Vaccine," you might divide an MMR vaccine into separate antigens, such as measles, mumps, and rubella. What other larger categories must be included? What challenges do you encounter in organizing the data? Refer to Chapte..

  Why supply-demand-equilibrium price different in short term

Price of product in short-term and long-term also describe why you believe supply, demand, or equilibrium price will be different, if at all, in short-term and long-term.

  What influence do differences have on fundamental equation

As the number of runs of the executable programs grows ("goes to infinity"), prove that the difference in compilation time on the two platforms becomes irrelevant for the total time for the program.

  You may have observed such a situation before a highly

you may have observed such a situation before a highly publicized and outrageous crime has taken place and the suspect

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