In keeping with your coding style, which is much different than mine, your script worked for me when I added the blue line shown in the code box below:
Code:
#!/bin/bash
set -e
count=10
i=1
while [ $i -le $count ]
do
tail -$i filename.txt
i=`expr $i + 1`
read -p "Hit [Enter] to continue or [Ctrl+C] to abort."
done
I'd have done it like this:
Code:
#!/bin/bash
set -e
for i in {1..10}; do
tail -$i filename.txt
read -p "Hit [Enter] to continue or [Ctrl+C] to abort."
done
exit 0
As you can see, steeldriver would have made it even shorter.
Bookmarks