Comment code blocks in a bash source file

Assignment Help Macroeconomics
Reference no: EM131299645

Write a bash script to comment code blocks in a bash source file. A bash comment is all characters from a # character (beginning a word) to the end of the line.

Conditions:

  • The source file will contain only printing characters, spaces, and newlines.
  • The source file will contain validbashcode. It is not necessary to check for invalid input.
  • The source file may contain nested blocks.
  • In the source file the keywords while until for case if done esac elif else fi 
    will be the first words on a line, will not be in comments, and will not be quoted.

Requirements:

  • Read from standard input, write to standard output.
  • At the end of any line containing while until for add the comment: # loop n 
    (n is a number, 1 for the first loop, 2 for the second loop, etc)
  • At the end of any line containing done add the comment: # loop n 
    (n is the number corresponding to the matching while until for )
  • At the end of any line containing if case add the comment: # selection n 
    (n is a number, 1 for the first selection, 2 for the second selection, etc)
  • At the end of any line containing fi esac add the comment: # selection n 
    (n is the number corresponding to the matching if case )

Include all of the following:

  • comments with your name, the date, and the assignment
  • comments with instructions for using the program
  • descriptive names and/or comments explaining variables & functions
  • indentation of code blocks
  • comments explaining any non-obvious control flow

Hints:

  • work on the simplest cases first
  • think about the structure of your data and logic before you write any code
  • start with the smallest possible amount of code
  • make sure your existing code works before adding new code
  • add the smallest possible amount of new code, then test again
  • output variable values, loop counts, etc. for debugging
  • test your code with a variety of inputs

Reference no: EM131299645

Questions Cloud

Calculate the best-case and worst-case npv figures : Suppose the projections given for price, quantity, variable costs, and fixed costs are all accurate to within ±10 percent. Calculate the best-case and worst-case NPV figures.
Five main points of risk assessment : Develop your introductory remarks to the teams, including five main points of risk assessment and five main points of incident response that you want to emphasize.
What is the history on ford motors company’s growth : Include a title page and 3-5 references. Please no reference from (Wikipedia). Please adhere to the Publication Manual of the American Psychological Association (APA), (6th ed., 2nd printing) when writing and submitting assignments and papers.
What is the net cash flow of the project each year : Assume that the tax rate is 35 percent and the required return on the project is 9 percent.- What is the net cash flow of the project each year?- What is the NPV of the project?
Comment code blocks in a bash source file : Write a bash script to comment code blocks in a bash source file. A bash comment is all characters from a # character (beginning a word) to the end of the line.
Calculate the break-even point for each firm : Compare the two companies. What conclusions could you make regarding the use of operating leverage employed by the two firms?
Make a risk information sheet for five potential risks : Create a Risk Information Sheet for at least five potential risks that should be considered. At least three of the risks you choose should be business continuity and IT disaster recovery related.
Provide an overview of olap : The data warehousing project group has invited you to provide an overview of OLAP (Online Analytical Processing) and OLTP (Online Transaction Processing).
How well do the five guidelines for that category apply : Pick one of the special applications of branding and choose a representative brand within that category. How well do the five guidelines for that category apply? Can you think of others not listed?

Reviews

Write a Review

Macroeconomics Questions & Answers

  What are two basic choices for get out of financial trouble

What are the two basic choices for them to get out of financial trouble Explain the impact of each. Why are some states playing for a federal bailout if needed. How is that like a game of Chicken Explain. Why would the New Congress do better to le..

  Elucidate foreign demand for dollars

Elucidate foreign demand for dollars as well as the international value of the dollar.

  Frisbees are produced according to the production function

frisbees are produced according to the production function q 2kl where q output of frisbees per hour k capital input

  Purely competitive producer

Assume that the cost data in the table below are for a purely competitive producer:

  Would country have borrow more if their economies privatized

In some of these countries, there have been moves to privatize the economy by selling state companies to private owners. Would the countries have borrowed more or less if their economies had been privatized earlier?

  Interpret the demand of the rich and demand of the poor

There are two types of consumers of potatoes: 10 are rich and 50 are poor.Interpret the differences between the demand of the rich and the demand of the poor.

  What is the republican nomination for president

Mitt Romney and Newt Gingrich are two of the most likely candidates for the Republican nomination for President. One of the key strategic decisions they will make is how negative their ads should be. Assume the payout matrix (in terms of votes gai..

  What does it cost you to sleep through one of the 30 lecture

What does it cost you to sleep through one of the 30 lectures in a course for which you paid $2000 in tuition? Do students put more effort into courses for which they have to pay higher tuition to take the course? Explain.

  Elucidate what is the cross elasticity of demand

Elucidate what is the cross elasticity of demand for pipes and pipe tobacco.

  Discuss necessary conditions to make price discrimination

Discuss the necessary conditions to make price discrimination work and the best practices to use price discrimination to maximize profits while avoiding price wars. In your discussion make evident the challenges of the strategy

  Determine additional dollar cost of adding sales people

Determine additional dollar cost of adding sales people and how is the expected net revenue generated through adding an additional salesperson given a firm's past sales experience?

  What are the pure-strategy nash equilibria to the game

Three friends (Julie, Kristin, and Larissa) independently go shopping for dresses for their high-school prom. Upon reaching the store, each girl sees only three dresses worth considering: one black, one lavender, and one yellow.

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