Question: The shell script srch.sh must accept exactly two arguments. The first argument shall represent the string to be searched. o The second argument represents either

The shell script srch.sh must accept exactly two arguments. The first argument shall represent the string to be searched.

o The second argument represents either the name of the file to be searched or a directory. If a directory is entered, then all files in the directory shall be searched.

o The script srch.sh shall use the script srchfile.sh to search for the string in a given file. If the second argument is a directory, then srch.sh will invoke srchfile.sh repeatedly in a loop.

If the user enters more or less than the required number of arguments, the script shall produce an error message and stop.

The script must be able to execute on cs.franklin.edu

The script file name must be: srch.sh

The script must be located in $HOME/itec400/homework

Make sure the permissions on the your itec400 directory are 705

Make sure the permissions on your script are 705

 The shell script srch.sh must accept exactly two arguments. The first

***Please use the template below - replace X***

argument shall represent the string to be searched. o The second argument

Sample Output Sunny Day scenario, searching for string 'then in file "ex0210" in "examples" directory: > srch.sh then /export/home/dandrear/public_html/itec 400/examples/ex0210 ------ File = /export/home/dandrear/public html/itec 400/examples/ex0210 ------ 7:then 11:then 15:then Sunny Day scenario, searching for string "then" in "examples which is a directory (search all files): > srch.sh then /export/home/dandrear/public_html/itec400/examples ------ File = /export/home/dandrear/public_html/itec400/examples/ex0010 ------ ------ File = /export/home/dandrear/public_html/itec 400/examples/ex0020 ------ ------ File = /export/home/dandrear/public html/itec400/examples/ex0030 ------ ------ File = /export/home/dandrear/public_html/itec 400/examples/ex0040 ------ ------ File = /export/home/dandrear/public_html/itec400/examples/ex0050 ------ ------ File = /export/home/dandrear/public_html/itec400/examples/ex0205 ------ ------ File = /export/home/dandrear/public_html/itec 400/examples/ex0210 ------ 7:then 11.then 15:then Rainy Day scenario, script is invoked with only one argument: > srch.sh then error: must provide 2 arguments. usage: srchfile.sh search-pattern file XXX ksh # Script name: srch.sh # Case #1: ./srch.sh # Case #1: ./srch.sh # Case #3: ./srch.sh

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!