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

  Find the consistency and elegance

1. UNIX is highly portable. What is portability? What makes UNIX so portable? Why is portability so important? 2. Why do you suppose professional programmers find the consistency and elegance of UNIX so appealing?

  Number of vowels and number

Write a function named count_vowels to count the number of vowels (a, e, i, o,u) in each line of the poem. Print the line with the largest number of vowels and this number. If there is a tie then print all the tied lines.

  Market funds and other deposits

checkable deposits owned by individuals and businesses were $1,402 billion; savings deposits were $6,884 billion; time deposits were $583 billion; and money market funds and other deposits were $647 billion. Calculate M1 and M2 in June 2013.

  How and why the uss deficit have an effect on tax payers

Discuss within your Learning Team how and why the U.S.'s deficit, surplus and debt have an effect on the following: Tax payers Future Social Security and Medicare users Write a 350- to 1,050-word paper that details your team's findings.

  Explain why the federal reserve will be less inclined

If the U.S. economy is operating near full employment and the exhange rate increases(the dollar appreciates),

  Many us companies have located in contries all over globe

Many US companies have located in contries all over the globe. Would they support or fight free trade. Explain your position.

  Computation of per capita gdp-population and gdp

If the US population is growing at .88% per year, while GDP is growing at 2.5% per year, and if these growth rates remain constant for the next five years, what will be the population and GDP levels in five years?  Please show your work.

  Provide the good may utilize the information

Distinguish between a change in demand and a change in the quantity demanded (movement along the demand curve). Propose two methods in which organizations that provide the good may utilize this information.

  An increase in the stock of capital of an economy

Skill-biased technical change, through its effect on labor supply of skilled and unskilled workers, can generate an increase in wage inequality"

  What did the recent sovereign debt crisis in europe have

What did the recent "Sovereign Debt Crisis" in Europe have to do with Fiscal Policy?What are the advantages and/or disadvantages of using monetary policy instead of fiscal policy?

  Could you have both a comparative and absolute advantage

could you have both a comparative and absolute advantage in trading. If so, what if at all would be the benefit for your country to trade with any other country.

  Economist is confortable using parameter estimates

This economist is confortable using parameter estimates that are statistically significant at the 10 percent level or better. Does PY have a statistically significant effect on the quantity demanded of good Y? Explain, using the appropriate p-value. ..

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