Count Lines From Standard Input in Shell

Here’s a script that will help you count the lines of input from the standard input:

Now, you can find out the number of files in a directory using:

Update

As Jeff Harver has kindly pointed out in the comments, the same thing as the long script above can be accomplished using:

2 thoughts on “Count Lines From Standard Input in Shell

Leave a Reply

Your email address will not be published. Required fields are marked *