An experiment: this repo will contain toy implementations of various core command line utilities.
You should not use anything in here for real work. I promise that they will be incomplete and buggy. The whole point is for me to learn a little more about C and Unix by writing these. They aren't meant to be substitutes for anyone's actual core-utils.
Works pretty much like
tail but simplified. Shows the last ten lines of
one or more files (given as arguments) or
stdin, if no arguments are
-h to show simple usage and
-c NUMBER to switch from
the default ten lines to another number.
make toy-tail to build it.
Yup, you guessed it.
toy-echo is just like
-n flag to
echo without a final newline is guaranteed to work on this one though.
make toy-echo to build it.
At this point, it's almost too obvious:
toy-cat is basically
with fewer flags. It only supports
-n. So you can get help or
line numbers. That's it.
head does. Accepts
-h to show usage and
-c NUMBER to
choose how many lines from the top of the file to show. The default
number of lines to show is ten.
make toy-head to build it.
make all should always build all utilities present.