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

  Inflation targeting be a good policy

Why might it be difficult for the Fed to formally adopt inflation targeting?  Would inflation targeting be a good policy for the Fed in the present economic environment

  In using the taylor rule

In using the Taylor Rule as a guideline for monetary policy, what are the pros and cons of using forecasted values of inflation and output rather than observed values of these variables?

  Describe the present economic crisis situation in europe

Describe the present economic crisis situation in Europe.  Why has it been so difficult for the Europeans to find a solution to this problem?   Comment on what implications the crisis may have for the rest of the world if Europeans are not able to ag..

  Long-term federal government budget problems

Question:. Explain why there are long-term Federal government budget problems. Explain why the base-line forecast of the CBO is misleading.

  Derive and compare demand curve

Question based on Derive and compare demand curve,  Derive Ambrose's demand function for peanuts. How does it compare with Johnny's demand curve for peanuts?

  Problem based on utility function

Problem based on  Utility Function - Problem,  Answer and explain the following using a diagram which is completely labeled.

  Laffer curve : tax rate and tax revenue

Question based on Laffer Curve : Tax Rate and Tax Revenue,  Do raising tax rates necessarily raise tax revenue? What factors affect how tax revenue changes when tax rates change?

  Problem - income elasticity of demand

Problem - Income Elasticity of Demand,  Interpret the following Income Elasticities of Demand (YED) values for the following and state if the good is normal or inferior; YED= +0.5 and YED= -2.5

  Positive balance of payment

Question Positive Balance of Payment: "Things will look good for the US if we could just get to where we are consistently running a positive Balance of Payments."

  Effect of recession on the investment curve

Comment on the effect of a recession on the investment curve (only) and on the level of savings, investment, and the equilibrium real interest rate in the financial crisis that hits United States first starting in fall 2007.

  Affect of falling domestic investment on trade surplus and

How will a fall in domestic investment affect the trade surplus and net capital outflows in the domestic economy, the trade deficit and capital inflows in the rest of the world.

  Crises in the banking sector and bank run

Banking crises crisis decreases depositors' confidence in the banking system. What would be the effect of a rumor about a banking crisis on checkable deposits in such a country?

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