[opensuse] Re: BASH - while read; howto read last line in file without blank line at end?
David C. Rankin wrote:
What is the trick to be able to read the last line of the repos file regardless of whether there is a blank at the end or not?
The canonical way is to use "tail -n 1". Joachim -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Joachim Schrod Email: jschrod@acm.org Roedermark, Germany -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Sunday 02 November 2008 11:27, Joachim Schrod wrote:
David C. Rankin wrote:
What is the trick to be able to read the last line of the repos file regardless of whether there is a blank at the end or not?
The canonical way is to use "tail -n 1".
That was mentioned. Plus the actual symptom came from there not being an end-of-line / newline on the final line of the file and the way that lack interacts with BASH's read built-in, not actually the absence of a blank last line. Thus the use of tail, which does not add an final newline when one is missing, would not itself fix the original script misbehavior.
Joachim
Randall Schulz -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (2)
-
Joachim Schrod
-
Randall R Schulz