所有软件外包项目 Gray arrow bg 做一个unix bash script的简单作业 a simple homework for ...

做一个unix bash script的简单作业 a simple homework for bash script

发包方 : Leongg 状态 :竞标已结束
项目编号 : 220364
项目预算 : 竞标出价
开发周期 : 7 天
技能 : Linux
发布日期 : 2016-05-15
竞标后显示联系方式

描述

Write a bash script to indent code blocks in a bash source file.

Conditions:

The source file will contain only printing characters, spaces, and newlines.
The source file will contain only valid bash code. It is not necessary to check for invalid input.
The source file will not contain function declarations.
The source file may contain random indentation.
The source file may contain nested blocks.
In the source file keywords while/until/for/case/if/done/esac/elif/else/fi will be the first words on a line and will not be quoted.
Requirements:

Read from standard input, write to standard output.
Lines inside a while/until/for block should indented two spaces. If the block's done is the first word on a line it should begin in the same column as the while/until/for .
Lines inside a case block should indented two spaces. If the block's esac is the first word on a line it should begin in the same column as the case .
Lines inside an if block should indented two spaces. If the block's elif/else/fi is the first word on a line it should begin in the same column as the if .
Lines with # in the first column should not be indented.
Lines not inside any block should not be indented.
Be sure your program includes 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
The program is due Tuesday May 17 at midnight. Submit your program by email on our class server with:

mail -s 'assignment 1' stuart < source-file
where source-file is the name of your program file.

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
anticipate error conditions and handle them gracefully.

竞标

请您先登录,然后提交此项目的竞标方案。
还不是智城用户? 智城期待您的加入,请注册成为我们的一员吧!
Project ad2