Ask Software Engineering Expert

chp1

1. Write a script that creates a directory calledbpl inside$HOME.Populate this directory with two subdirectories,binand scripts.
2. Write a script to create the "Hello, World!" script,hw, in$HOME/bpl/bin/; make it executable; and then execute it.

chp 2

1.What is wrong with this command?
tr A Z < $HOME/temp > $HOME/temp

2.Write a script, using$RANDOM, to write the following output both to a file and to a variable. The following numbers are only to show the format; your script should produce different numbers:
1988.2365
13798.14178
10081.134
3816.15098

chp 3

1.Write a script that asks the user to enter a number between 20 and 30. If the user enters an invalid number or a non-number, ask again. Repeat until a satisfactory number is entered.

2.Write a script that prompts the user to enter the name of a file. Repeat until the user enters a file that exists.

chp 4

1.How many arguments are there on this command line?
sa $# $(date "+%Y %m %d") John\ Doe
2.What potential problem exists with the following snippet?
year=$( date +%Y )
month=$( date +%m )
day=$( date +%d )
hour=$( date +%H )
minute=$( date +%M )
second=$( date +%S )

chp 5
1.By default, where can a variable assigned in a script be accessed? Select all that apply:
•In the current script
•In functions defined in the current script
•In the script that called the current script
•In scripts called by the current script
•In subshells of the current script
2.I advise against using single-letter variables names but give a couple of places where they are reasonable. Can you think of any other legitimate uses for them?
3.Givenvar=192.168.0.123, write a script that uses parameter expansion to extract the second number,168.

chp 6
1. Rewrite functionisvalidipusing parameter expansion instead of changingIFS.
2. Add a check to_max3to verify that all three arguments are integers.

chp 7
1.What is wrong with this code (besides the inefficiency noted at the beginning of the chapter)?
if ! echo ${PATH} |grep -q /usr/games
PATH=$PATH:/usr/games
fi
2.Write a function calledto_lowerthat does the opposite of theto_upper function in Listing 7-4.
3.Write a function, palindrome, that checks whether its command-line argument is a palindrome (that is, a word or phrase that is spelled the same backward and forward). Note that spaces and punctuation are ignored in the test. Exit successfully if it is a palindrome. Include an option to print a message as well as set the return code.
4.Write two functions,ltrimand rtrim, that trim characters in the same manner astrim but from only one side of the string, left and right, respectively.

chp 8
1. Modify thekjvfirsts script accept a command-line argument that specifies how many chapters are to be printed.
2.Why are the chapter and verse numbers inkjvfirstsformatted with%sinstead of%d?
3. Write anawkscript to find the longest verse in KJV.

chp 9
1.Write a script that stores the time it takes a command (your choice of command) to run in three variables,real, user, andsystem, corresponding to the three default times that timeprints.

chp 10
1.What is wrong withif [ $var=x ]? What should it be? Why does it give the result it does?
2.Write a function, valid_square(), that returns successfully if its sole argument is a valid SAN chessboard square or fails if it is not. Write a function to test that it works.

chp 11
1.Modify themenufunction to accept its parameters from a file.
2.Rewrite thepr1function asprxthat will behave in the manner ofpr4from
Chapter 8 but will take an option for any number of columns.
3.Add agetoptssection to thefifteengame that allows the user to select between three different board formats. Write a third format.

chp 12
1.Add code to theupload script that checks that all variables have been set to legitimate values (for example, thatportis an integer).
2.Write ausageorhelp function, and add it to theuploadscript.
3.Add an option to theuploadscript to save the configuration if it has been saved.
4.Write a script that creates a configuration file in the same form aswords.cfg, prompting the user for the information to put in it.

chp 13
1.Modify theisortandasearchfunctions to usesortandgrep, respectively, if the array exceeds a certain size.
2.Write a function that transposes rows and columns in a grid (either a single-string grid or an array). For example, transform this:
123
456
789
into this:
147
256
369
3.Convert some of the grid functions, either string or array versions, to work with grids that are not square, for example, 6×3.
4.Convert the code that parses fixed-width records into a function that accepts the line of data as the first argument, followed by thevarname=width list.

chp 14
1.Write a function,hbar, that accepts two integer arguments, a width and a color, and prints a bar of that color and width. Write a second function,hbar_at, that accepts four arguments, row, column, width and color; moves the cursor to the row and column; and passes the remaining arguments tohbar.
2.White a function,clear_area, that accepts two integer arguments, rows and columns, and clears a rectangular area of that many rows and columns.

chp 15.
1.Using thekey-funcslibrary, write a menu script that uses the function keys for selection.
2.Rewrite thekey-funcslibrary to include mouse handling, and incorporate the function into the mouse-demo script.
3.Thepasswordscript does minimal checking for invalid entries. What checking would you add?
How would you code it?

Software Engineering, Computer Science

  • Category:- Software Engineering
  • Reference No.:- M9906558
  • Price:- $60

Priced at Now at $60, Verified Solution

Have any Question?


Related Questions in Software Engineering

In this assignment you will answer the following questions

In this assignment, you will answer the following questions related to Android platform and Android security design. 1. Describe Android architecture in detail by explaining the four conceptual layers. 2. Describe Androi ...

The research paper for this course is about some of the

The research paper for this course is about some of the best sources of digital evidence for child abuse and exploitation, domestic violence, and gambling according to the National Institute of Justice. Research commerci ...

Research projectin the course we have covered various

RESEARCH PROJECT In the course, we have covered various security and privacy issues that arise in the cyberspace field. We have learned to identify these risks and have discussed the current approaches and developments f ...

Overviewyou are required to modify and logically extend

Overview You are required to modify and logically extend the functionality of a provided code base to implement a game. This requires you to modify the code base as well as create documentation and implement various user ...

Address the following integrating biblical perspectives

Address the following, integrating biblical perspectives where appropriate: Define a hate crime and describe how white supremacist groups use the Internet to spread their message of hate. Explain why hate crime legislati ...

In this assignment you will answer the following review

In this assignment, you will answer the following review questions from the reading materials of the module/week. 1. "What are the key components of a typical P2P application? Describe their functions." 2. "What are the ...

Write reply to this article with references with apa

Write reply to this article with references with APA bibliography. Hate Crimes Over the past couple of years, hate crimes have been on the rise in America's largest cities. Studies show that there were sharp spikes in th ...

Reply to this article with apa referencehate crimes

Reply to this article with APA reference. Hate crimes According to Merriam-Webster, hate crime is any of various crimes (such as assault or defacement of property) when motivated by hostility to the victim as a member of ...

Proposaldesign of an efficient gps tracking system tag for

Proposal Design of an efficient GPS Tracking System (tag) for monitoring small species IMPLEMENTING EMBEDDED SYSTEMS USING SYSML Task Using PapyrusSysML Software (Downloadable online - Evaluation Copy- Latest Version) Mo ...

Write review on this article with apa formatgovernment

Write review on this article with APA format. Government surveillance is a major issue in the United States and globally. Surveillance refers to any collection and processing of personal data, whether, identifiable or no ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As