Question

Linux & Unix Write a bash program to indent the code in a bash source file....

Linux & Unix

Write a bash program to indent the code in a bash source file.

Conditions:

    The source file will contain only printing characters, spaces, and newlines. It is not necessary to check for invalid input.
    The source file will not contain comments (words beginning with #).

Requirements:

    Read from standard input, write to standard output.
    Code inside while statements should be indented 2 spaces.

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 (in your source)
    comments explaining any non-obvious control flow

The program is due Sunday Jan 03 at midnight. Submit your program by email on our class server with:
  mail -s 'assignment 2' stuart < source-file

where source-file is the name of your program file.

Hints:

    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.

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
Linux & Unix Write a bash program to indent the code in a bash source file....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • Write a C program as follows: Single source code file Calls a function with an arbitrary...

    Write a C program as follows: Single source code file Calls a function with an arbitrary name (i.e. you name it) that accepts two arrays of the same size The function should add each element in the arrays together and place the values in a third array Each array element, each array address, and the sum are printed to the screen in tabulated format with headersI also would like to request that LOTS of comments be included, as I need...

  • Write a program that will check a Java file for syntax errors. The program will ask...

    Write a program that will check a Java file for syntax errors. The program will ask for an input-file name and output-file name and will then copy all the code from the Java input file to the Java output file, but with the following changes: 1. Any syntax error found in the Java input file will be corrected: a. Missing semicolon b. Missing compound statements (curly braces) c. All comments have to start with // and end with a period....

  • Write a C program as follows: Single source code file Requests the user to input two...

    Write a C program as follows: Single source code file Requests the user to input two integer numbers Requests the user to make a choice between 0 (add), 1 (subtract), or 2 (multiply) Declares three separate functions Uses a pointer to these three functions to perform the requested action Outputs the result to the screen Submit your program source code file to this assignment. Sample Output Enter first integer number: 15 Enter second integer number: 10 Enter Choice: 0 for...

  • WRITE A CODE IN C++ A CLASS WITH MEMBER FUCNTIONS THAT COUNTS THE LINES OF CODE...

    WRITE A CODE IN C++ A CLASS WITH MEMBER FUCNTIONS THAT COUNTS THE LINES OF CODE OF C++ FILE OR TEXT FILE .COMMENTS SHOULD NOT BE COUNTED AND SPACE BETWEEN LINES OF CODE SHOULD BE IGNORED AS WELL. ASK FOR INPUT FROM THE USER IT CAN BE CPP FILE OR TEXT FILE Assignment:Write a program to count lines of code according to your LOC Counting Standard. Notes: -Your program should accept as input the name of a file that contains...

  • ( IN JAVA): Write a program that reads each line in a file, and writes them...

    ( IN JAVA): Write a program that reads each line in a file, and writes them out in reverse order into another file. This program should ask the user for the name of an input file, and the name of the output file. If the input file contains: Mary had a little lamb Its fleece was white as snow And everywhere that Mary went The lamb was sure to go Then the output file should end up containing: The lamb...

  • Write a C++ program that reads text from a file and encrypts the file by adding...

    Write a C++ program that reads text from a file and encrypts the file by adding 6 to the ASCII value of each character. See section 5.11 in Starting out with C++ for information on reading and writing to text files. Your program should: 1. Read the provided plain.txt file one line at a time. Because this file has spaces, use getline (see section 3.8). 2. Change each character of the string by adding 6 to it. 3. Write the...

  • LINUX 140U Create a file named script1.sh that contains a bash script that: Accepts NO command...

    LINUX 140U Create a file named script1.sh that contains a bash script that: Accepts NO command line arguments and does NOT use the read command. I will give you no credit if your bash script includes a read command. Also, you need to have at least one for..in loop in your code even if there may be other ways to do this problem. The script will go through a list of entries in the current directory (do not process subdirectories):...

  • Write a program **(IN C)** that displays all the phone numbers in a file that match the area code...

    Write a program **(IN C)** that displays all the phone numbers in a file that match the area code that the user is searching for. The program prompts the user to enter the phone number and the name of a file. The program writes the matching phone numbers to the output file. For example, Enter the file name: phone_numbers.txt Enter the area code: 813 Output: encoded words are written to file: 813_phone_numbers.txt The program reads the content of the file...

  • Write a PYTHON program that asks the user for the name of the file. The program...

    Write a PYTHON program that asks the user for the name of the file. The program should write the contents of this input file to an output file. In the output file, each line should be preceded with a line number followed by a colon. The output file will have the same name as the input filename, preceded by “ln” (for linenumbers). Be sure to use Try/except to catch all exceptions. For example, when prompted, if the user specifies “sampleprogram.py”...

  • Write a program that reads a Java source-code file and reports the number of keywords (including...

    Write a program that reads a Java source-code file and reports the number of keywords (including null, true, and false) in the file. If a keyword is in a comment or in a string, don’t count it. Test your program to count the keywords in the Welcome.java file: Please input the Java filename: Welcome.java The number of keywords in the program is 6

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT