How could i go printing the number of words in a specified file in a bash script. For example it will be run as
cat test | ./bash_script.sh
cat test
Hello World
This is a test
Output of running cat test | ./bash_script
would look like
Word count: 6.
I am aware that it can be done without a script. I am trying to implement wc -w
into a bash script that will count the words like shown above. Any help is appreciated! Thank You