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

  A direct-mapped cache with 8 two-word blocks

Based on the following sequence of word addresses generated by the processor:1, 134, 212, 1, 135, 213, 162, 161, 2, 44, 41, 221a) Given a direct-mapped cache with 8 two-word blocks that is initially empty

  Write bash shell script filestatic to examine number files

Write bash shell script filestatic. Script should examine the number files in directories given as arguments (parameters) to this script.

  Framing rules work if stuffing rule to stuff zero changes

Will framing rules work if we change stuffing rule to stuff a zero only after 6 consecutive ones? Describe. Will protocol work if we change stuffing rule to stuff 0 only after a zero followed by 5 consecutive ones? Describe.

  Display a graphical representation of the binary search tree

The program should display a graphical representation of the binary search tree. Show all the leaf nodes; Show all the nodes in PreOrder, InOrder and PostOrder traversals.

  Recognize the types of each variable as nominal and ordinal

Suppose you are working on data analysis project about laptop computers. Each computer is explained by following variables. Recognize the types of each variable as nominal, ordinal, interval or ratio.

  How to use the input validation

Requirement Determine if a word is a palindrome Using a cloulread in a word chaster by character Store each character in its own node.

  What are some other practical applications

What are some other practical applications you see fit for such models? Justify your answers with examples and reasoning.

  Write a method, insertat, that takes four parameters

write a method, insertAt, that takes four parameters:an array of integers; the length of the array; an integer, say insertItem; and an interger, say, index.

  Indicate whether or not there is a carry

1 ) What is the base-10 equivalent of: 1111, a 4-bit one's complement number 4) Add the following 16-bit 2's complement numbers (represented in Hex): 78CF + FAB4 and indicate whether or not there is a carry and/or an overflow generated. Also, if n..

  Create a program that will store results of your dice game

Create a program that will store the results of your dice game in a comma separated value file (filename.csv). You will use the Formatter API to construct a new file.

  Suppose that you are connected to a database termed

assuming that you are connected to a database called computers.mdb with the fields computer hostname roomnum cputype

  Analyze the class performances

Design a data warehouse for a university's gradebook data to analyze the class performances. Suppose the data warehouse  consisting of the following dimensions: department, semester, course, student, instructor, and gradebook; and a set of measures y..

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