NewtownGuy
Technical User
I have a bash script that is supposed to process the ten last lines, or fewer in files with fewer than ten lines, of a text file. I use 'tail' to read these lines into a new text file, which I then read into an array. There's a problem when the file being read has fewer than ten lines. The problem is that I always get ten lines regardless of how many lines are in files with fewer than ten lines. The first lines are correct, but the balance of the ten lines comes from other files. The tail command works fine from the command line.
Why do I always get ten lines when the script runs and how do I get no more lines than are in the file ?
Thank you in advance for your help.
Why do I always get ten lines when the script runs and how do I get no more lines than are in the file ?
Thank you in advance for your help.