run-gcc
is a versatile Bash script designed to simplify the process of compiling and running C and C++ programs. It provides features such as input/output handling, output comparison, and error reporting, making it a convenient tool for developers and testers.
- Automatically detects the file type (
.c
or.cpp
) and uses the appropriate compiler (gcc
org++
). - Supports input redirection from a file.
- Compares program output with an expected output file and displays differences.
- Provides detailed error messages for unsupported file types, missing files, and compilation errors.
- Includes options for displaying help and version information.
For detailed instructions on installing, updating, and uninstalling run-gcc
, please refer to the Installation Guide.
To install run-gcc
using the provided Makefile
, run:
make install
This will install the script to /usr/bin
and the manual page to /usr/share/man/man1
.
To uninstall, run:
make uninstall
run-gcc <source_file> [OPTIONS]
-
-h, --help
Show the help message and exit. -
-v, --version
Show the script version and exit. -
-i, --input <file>
Specify an input file to provide input to the program. -
-e, --expected <file>
Specify an expected output file for comparison. -
-d, --diff
Show the difference between the program output and the expected output.
run-gcc hello.c
run-gcc hello.cpp
run-gcc hello_with_input.c -i input.txt
run-gcc hello_with_input.c -i input.txt -e expected_output.txt
run-gcc hello_with_input.c -i input.txt -e wrong_output.txt -d
The project includes automated tests written in Bats. To run the tests, execute:
make test
Contributions are welcome! If you'd like to contribute to run-gcc
, please follow the guidelines outlined in the Contributing Guide.
- Fork the repository and clone it locally.
- Create a new branch for your feature or bug fix.
- Make your changes, ensuring they follow the project's coding conventions.
- Test your changes thoroughly.
- Submit a pull request with a detailed description of your changes.
For more details, refer to the Contributing Guide.
This project is licensed under the MIT License. See the LICENSE file for details.