
Bash Auto Grader
Bash application to automatically grade student homework submissions via output comparison.
Project Role - Primary Developer & Planner
​​​
Project Year - 2024
​​​​
Project Type - Student Project (Group)
​​
Project Location - Santa Clara, CA​​​
Result
The project delivered a functional autoGrader.sh script, a defined directory structure populated with sample data, a documented codebase explaining setup and script logic, a visual flowchart of the system design, and a presentation outlining the project.
The script successfully graded these mock homework submissions and updated the grade table.
Overview
S
Situation
A Systems Programming course assigned a final project to automate homework grading.
The task involved processing student submissions for specific assignments, comparing their outputs to provided solutions, calculating scores based on differences, and updating a central grade record within a defined directory structure.
T
Task
The objective was to create a Bash shell script (autoGrader.sh) capable of automatically checking student rosters, running student code submissions, comparing outputs against instructor solutions, calculating points based on similarity (output differences), and aggregating scores into a main grade table.
A
Action
The team planned the application structure using a Lucidchart flowchart.
They established a detailed directory structure in PuTTY to house student submissions, instructor solutions, expected outputs, and grading records.
The core autoGrader.sh script was developed using Bash commands to implement the grading logic.
R
My Highlights
Architected System Structure
-
Designed the project's file organization and process flow using Lucidchart; provided the foundational plan enabling collaborative development and clear visualization.
Developed Core Grading Logic
-
Authored the majority of the autoGrader.sh Bash script; implemented the primary functionality for parsing submissions, comparing outputs, and calculating grades.
Led Project Documentation & Presentation
-
Created comprehensive code documentation explaining setup and script functionality, and presented the major technical sections of the project deliverable.
Skills

Bash Scripting
Authored the extensive project script, utilizing loops, conditionals, variables, commands and standard CLI tools within PuTTY
Owned Skill

System Architecture & Design
Planned the overall application flow and directory structure, visualized via Lucidchart.
Owned Skill

Algorithm Development
Devised the logic within the script for comparing outputs (diff, wc) and calculating grades based on differences.
Owned Skill

Problem Analysis
Addressed coding challenges, leveraging external resources for specific issues, and error spotting.
Owned Skill

Technical Writing & Documentation
Wrote detailed comments and explanations for the file setup process and the autoGrader.sh script logic.
Owned Skill

Version Control Practices
Managed distinct student/instructor files and homework versions using organized directories.
Collaborated Skill

Requirements Gathering & Analysis
Interpreted the project objective to define necessary features like roster checks and output comparison.
Collaborated Skill

Collaboration & Teamwork
Worked as a two-person team, using tools like Lucidchart to enhance communication during conceptualization.
Collaborated Skill
Details
Details
Table of Contents
- Project Overview & Goals -
​​
- ​My Work -
​​
- Methodology & Approach -
​​
- Key Activities & Execution -
​​
- Deliverables & Outcomes -
​​
- Tools & Technologies Used -
Project Overview & Goals
​Project Overview
This project originated within a systems programming course as the final assignment. The central problem, as defined in the project documentation, was to address the needs of a hypothetical "lazy" instructor who required an automated solution for grading homework assignments. The manual process of evaluating individual student submissions, comparing them against correct solutions, assigning points, and updating a gradebook is time-consuming and prone to inconsistency. The goal was to create a robust Bash shell script application, running within a Linux/Unix environment (specifically PuTTY), that could automate this entire grading workflow for a given homework assignment.
​
​Project Goals
The primary objective explicitly stated: develop a bash application named autoGrader.sh that automatically grades a specified homework assignment. Key required features included:
​
-
Utilizing a student roster file (roster.csv ) to identify which students' submissions needed grading.
​
-
Executing the instructor's solution code to generate the expected output for comparison.
​
-
Executing each relevant student's submission code.
​
-
Comparing the student's output against the instructor's expected output for each problem within the assignment.
​
-
Calculating a grade for each problem based on the degree of similarity (or difference) between the student's output and the expected output. The documented method involved using the diff command and counting differing lines (wc -l).
​
-
Summing the points awarded for individual problems to get a total score for the homework submission.
​
-
Adding this calculated total score to a central gradebook file (mainTable.csv ), updating the record for the specific student and assignment.
​
The project focused specifically on demonstrating this functionality for Homework 3 (HW3), although the directory structure included placeholder files for HW1 and HW2 to illustrate a more complete system concept. The project involved two team members and required deliverables, including the code itself and a video presentation demonstrating its functionality. The development environment was PuTTY, executing within a standard Unix-like command-line interface.
My Work
​Project Planning & System Architecture Design
​​
-
Planning: Led the initial planning phase, translating project requirements into a workable structure.
​
-
Lucidchart: Created the foundational Lucidchart flowchart that visualized the directory structure, data flow, and script logic. This visual plan guided the team's implementation effort.
​
-
Tools & Methods Used: Lucidchart, requirements analysis.
​​
-
Linkage/Enablement: The Lucidchart provided a clear, shared understanding of the project structure and process, facilitating subsequent directory setup and script development by the team
​
Core Bash Script Development (autoGrader.sh)
​
-
Scripting: Authored the majority of the autoGrader.sh script, implementing the primary grading logic. This involved writing Bash code to:​
-
Fetch instructor solutions and student submissions using awk.
-
Dynamically execute the fetched code using eval.
-
Implement the output comparison logic using diff and wc -l.
-
Develop the grading algorithm using conditional statements (if/elif/else) and arithmetic operations to assign points based on output differences.
-
Manage the gradebook update process, including creating temporary files, merging data with paste, and formatting output with column.
-
Incorporate user feedback and pacing elements using echo and sleep.
-
​
-
Troubleshooting: Troubleshooted and debugged the script, occasionally referencing external resources.​​​
​
-
Tools & Methods Used: Bash scripting, vi editor, Linux CLI tools (awk, eval, diff, wc, if/then/else, paste, rm, column, etc.), PuTTY environment, debugging techniques.
​​
-
Linkage/Enablement: This core script represented the central deliverable, fulfilling the project's main objective. The functioning script processed the data structures set up by the team and performed the automated grading task
​
Code Documentation and Presentation
​
-
Detailed Documentation: Authored the detailed documentation within Code.pdf explaining the purpose and functionality of the setup commands and the autoGrader.sh script.
​
-
Technical Presentation: Prepared and delivered the main technical portions of the final project presentation, explaining the system's design and functionality.
​
-
Tools & Methods Used: Technical writing, presentation software.
​
-
Linkage/Enablement: The documentation provided clarity on the project's implementation. The presentation communicated the project's value, design, and outcomes to the intended audience (course professor).
​​
Methodology & Approach
​Project Approach
The team's approach began with a crucial planning phase before significant coding commenced. Recognizing the need for a clear structure, we utilized Lucidchart, a web-based diagramming tool, to create a detailed flowchart. This flowchart served as a visual blueprint, outlining the intended directory structure, the flow of data between different components (student submissions, instructor solutions, grading script, gradebook), and the sequence of operations the autoGrader.sh script would perform. This planning phase, centered around the Lucidchart diagram, was instrumental in providing a clear overview and enhancing team communication and collaboration during the conceptualization stage. Although the final implementation deviated slightly from the initial flowchart due to adjustments made during development, the chart provided the essential "jumping-off point" for the project.
​
Project Development
Following the planning phase, the next step involved translating the conceptual structure into a tangible file system hierarchy within the PuTTY environment. Based on the flowchart, the team systematically created the necessary directories and subdirectories using standard Linux commands like mkdir. This structure deliberately separated concerns, creating distinct top-level directories for Students and Instructor. Within Students, further subdirectories were made for each student (student1, student2, student3), and within each student's directory, subdirectories for each homework assignment (HW1, HW2, HW3) were created. Similarly, the Instructor directory was organized with subdirectories for homework (containing questions, solutions, and expectedOutputs), the main grading script (autoGrader.sh), the overall gradebook (mainTable.csv), and the student list (roster.csv). The tree command was used to visualize this structure during setup.
With the directory structure in place, the team populated it with necessary files using commands like touch (to create empty files) and printf (to insert initial content like headers and data). This included setting up placeholder files for HW1 and HW2, creating the actual questions (HW3questions.csv), instructor solutions (HW3solutions.csv), student submissions (HW3submission.csv for each student with slightly varying answers for testing), the initial mainTable.csv, and the roster.csv. A key file, alice.txt, used as the input text for the homework problems involving grep, was copied into the relevant directories using cp.
The core of the project involved writing the autoGrader.sh script using a text editor (vi) and making it executable (chmod). The script's logic involved fetching instructor solutions and student submissions using awk to parse the CSV files, executing these commands dynamically using eval, comparing the resulting outputs using diff piped to wc -l to count differing lines, implementing conditional logic (if/elif/else) to assign points based on the difference count, calculating total scores, and finally updating the gradebook by creating a temporary column file (new_column.csv), merging it with the main table using paste, and then displaying the result using column before cleaning up temporary files (rm). The script also included echo commands for user feedback and sleep commands to pace the output. Comprehensive documentation was written retrospectively to explain the code.
Key Activities & Execution
The execution phase involved several key activities documented by the team:
​
Planning and Design
Collaboratively conceptualizing the system's architecture and workflow, primarily visualized through the creation of a Lucidchart flowchart. This represented the initial design effort.​
​
Environment Setup
Creating the nested directory structure within PuTTY as per the design, using mkdir commands to establish the Students and Instructor hierarchies and their respective subdirectories for homework, solutions, etc..
Data Population
Creating and populating essential data files. This included:​
​
-
Copying the base text file (alice.txt).
​
-
Creating empty placeholder files for HW1/HW2 (touch).
​
-
Creating and writing headers/content for HW3 question files (HW3questions.csv) using touch and printf.
​
-
Creating and writing headers/content for HW3 student submission files (HW3submission.csv) using touch and printf, ensuring slight variations for grading tests.
​
-
Creating and writing headers/content for HW3 instructor solution files (HW3solutions.csv).
​
-
Creating and populating the initial gradebook (mainTable.csv) and roster (roster.csv).
​
​Script Development
Writing the autoGrader.sh Bash script. This involved implementing logic to:
​
-
Read data from files (awk).
​
-
Execute stored commands (eval).
​
-
Compare command outputs (diff, wc).
​
-
Perform conditional grade calculations (Bash arithmetic, if/elif/else).
​
-
Manipulate files for gradebook updating (echo to file, paste, rm).
​
-
Provide user feedback (echo, sleep, column).
​Documentation
Writing detailed explanations of the file setup commands and the logic within the autoGrader.sh script, acknowledging this was done mostly after the code was functional.
Presentation​
Creating and delivering a presentation summarizing the project's objective, features, planning, organization, and including a demonstration.
Deliverables & Outcomes:
The documented deliverables and outcomes of this project include:
​The autoGrader.sh Script
A functional Bash script capable of automatically grading student homework (specifically HW3) based on comparing command outputs against instructor solutions and updating a grade file. This was the primary technical artifact.
​Directory Structure and Data
A complete, organized directory hierarchy (finalProject) containing separate spaces for student work and instructor materials, populated with sample data (alice.txt, HW submission/question/solution files, roster, initial gradebook) necessary for the script's operation and demonstration.
​
​Lucidchart Diagram
A visual diagram illustrating the system's design, file interactions, and process flow, used for planning and communication. An image of the chart is included in the presentation and a link provided.
​Code Documentation
A document (Code.pdf) detailing the commands used to set up the directory structure and files, along with an extensively commented version of the autoGrader.sh script explaining its logic section by section.
​Project Presentation
A presentation (Presentation.pdf) outlining the project's objective, features, planning process (highlighting the flowchart), file organization, and including a placeholder for a demo.
​Automated Grading Results
The script successfully processes the sample student submissions for HW3, compares them to solutions, calculates individual problem scores and total scores based on output differences, and displays these results. It also generates an updated grade table (updatedMainTable.csv) incorporating the new HW3 scores.
​
The project successfully met the core objective of creating an automated grading application for the specified task. The use of Lucidchart for planning was noted as beneficial for collaboration and clarity and acknowledged positively by the professor.
Tools & Technologies Used
Bash (Bourne Again SHell)​
The scripting language used to write the autoGrader.sh program.
Linux/Unix Command Line Tools
A variety of standard utilities were employed within the Bash script and for setup:
​
-
mkdir : Creating directories.
​
-
cp : Copying files.
​
-
touch : Creating empty files.
​
-
printf : Writing formatted text to files/standard output.
​
-
awk : Pattern scanning and processing language, used here to extract specific fields (submissions, solutions) from CSV files.
​
-
eval : Executing arguments as a shell command, used to run the student/instructor code stored as strings.
​
-
diff : Comparing files line by line, used to find differences between student and instructor outputs.
​
-
wc (with -l flag) : Counting lines, used in conjunction with diff to quantify output differences.
​
-
echo : Displaying messages and variables.
​
-
sleep : Pausing execution for a specified time.
​
-
vi : Text editor mentioned for creating the script file.
​
-
chmod : Changing file permissions to make the script executable.
​
-
paste : Merging lines of files, used to add the new HW3 grade column to the main table.
​
-
rm : Removing files, used for cleanup of temporary files.
​
-
column (with -t -s '\t') : Formatting input into columns, used to display the updated grade table neatly.
​
-
tree : Displaying directory structure (mentioned as used during setup visualization).
​
-
grep : Pattern matching tool, the subject of the homework problems being graded.
​
​PuTTY​
The terminal emulator software used as the development and execution environment, indicating a standard Linux/Unix server backend
​
Diagramming Tools
Web-based diagramming software, Lucidchart used for creating the project flowchart during the planning phase.​
CSV (Comma Separated Values)
File format used for storing structured data like homework questions, submissions, solutions, roster, and grades. Tab-separated (\t) variation was used in the script's awk commands and paste.
​
Communication Tools
Video conferencing was utilized for routine group meetings and was referenced for the planned conceptual daily stand-ups.​
​
Collaboration Tools
Google Drive and Google Docs were the primary collaboration tools.