I'm writing a basic shell script to just read a file from the bottom line up. It will read each line, line by line then it will execute the line from the file. I currently am just trying to have it print out each line and I am getting an error running my program.
I am getting an error on line 5 which is my while loop like. My count value is currently 306 and I get an error saying: ./rebuildall.sh[5]: 306: not found.
Any ideas. My code is below. I know I am missing something simple.
Thank you
Code:
#!/bin/sh
#echo $1
count=`wc -l test.out | cut -c1-8`
count=`expr $count + 0`
while ($count >= 0)
do
#echo $file_length
line=`head -$count test.out | tail -1`
echo $line
count = `expr $count - 1`
done