Skip to content

Barcelona|oct2025-02|Zhenishai Zhanybek|Sprint-3|Module-Tools|ImplementShellTools - #6

Open
Jenishai5 wants to merge 2 commits into
mainfrom
implementShellTools
Open

Barcelona|oct2025-02|Zhenishai Zhanybek|Sprint-3|Module-Tools|ImplementShellTools#6
Jenishai5 wants to merge 2 commits into
mainfrom
implementShellTools

Conversation

@Jenishai5

Copy link
Copy Markdown
Owner

Implement Shell Tools: cat, ls, wc

This PR includes implementations of three classic Unix command-line tools: cat, ls, and wc, built using Node.js.

cat
Supports reading and printing file contents
Implemented flags:
-n → numbers all lines
-b → numbers only non-empty lines
Supports multiple files (*.txt)
Line numbering continues across multiple files (like real cat)
ls
Lists directory contents
Implemented flags:
-1 → one entry per line
-a → includes hidden files

wc
Counts lines, words, and bytes
Implemented flags:
-l → lines
-w → words
-c → bytes
Supports multiple files and outputs total counts
Default behavior shows all three metrics
Approach

I implemented each tool incrementally:

Basic functionality for a single file/directory
Support for multiple inputs
Added flags and edge case handling
Notes
Focused on matching expected behavior for the specified commands
Some advanced features of the original Unix tools are not included (stretch goals)

This exercise helped me better understand:

Working with the file system in Node.js
Parsing CLI arguments
Handling edge cases like empty lines and hidden files
How real shell tools behave under the hood

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant