Here is a small shell script that counts the lines, words and characters in a file. Most shell scripts utilize other programs. In this case, it is wc, the standard Unix utility to count words, lines and characters in a file. Without further delay, let's get into the source code. We'll explain it later.
Please note that this article assumes you already know how to write and execute a shell script.