There is a simple command which prints the number of lines in a file.:
wc -l
When I use this command to a regular text file. It counts the lines correctly. But when I count the lines in some bash script, this command gives a value one line less than the lines in this script actually.
For example, if I'll run this script with name script.sh :
#!/bin/bash
echo $(wc -l $0)
In the terminal I will get the output:
2 ./script.sh
When use this command for txt-file with 5 lines I see:
5 filename.txt
Why did wc count so?