This project was aimed at recreating two fundamental Bash utilities, cat and grep, both of which are integral to Linux terminal operations.
git clone https://github.com/0xmisha/bash-utils.git
cd bash-utils/src/cat
make
bash test.sh
- Gcc
- Make
-
Cat Utility:
- All flags, including the GNU versions, as specified in the documentation, were implemented. This includes numbering non-empty lines, displaying end-of-line characters, squeezing multiple adjacent blank lines, and more.
- The source, header, and build files for this utility were placed in the
src/cat/directory, and the executable was nameds21_cat.
-
Grep Utility:
- The basic implementation supported flags such as
-e,-i,-v,-c,-l, and-n. For regular expression parsing, only thepcreorregexlibraries were permitted. - An advanced bonus implementation added support for flags like
-h,-s,-f, and-o. - A further enhancement allowed for the pairing of flag combinations, like
-ivand-in. - All source, header, and build files were organized in the
src/grep/directory, with the executable beings21_grep.
- The basic implementation supported flags such as
-
Development Standards:
- The codebase adheres to the C11 standard using the
gcccompiler. - Strictly followed the Google coding style, ensuring clarity and maintainability.
- Made extensive use of Makefile for building, with targets like
s21_catands21_grep. - Adherence to the principles of structured programming was paramount, minimizing code duplications and maximizing module reusability. Shared modules were placed in the
src/commondirectory. - Integration tests were crafted to ensure the utilities' behavior mirrored that of their genuine Bash counterparts.
- The codebase adheres to the C11 standard using the
Through this exercise, the foundational principles of structured programming were reinforced, and the inner workings of primary Bash utilities were deeply understood.
