I am trying to write a shell script that asks a user for number of lines they would like to display from a file and then display those lines.
I am trying to do this via the following:
#!/bin/bash
#author = johndoe
read -p "How many lines from /c/Users/johndoe/files/helpme.sh would you like to see? " USERLINEINPUT
LINE_NUM=1
while [ $LINE_NUM -lt $USERLINEINPUT ]
do
echo "$LINE_NUM: $USESRLINEINPUT"
((LINE_NUM++))
done < /c/Users/johndoe/files/helpme.sh
This code doesn't appear to do as I'd like, please see an example below:
$ ./linecount.sh
How many lines from /c/Users/johndoe/files/helpme.sh would you line to see? 10
1:
2:
3:
4:
5:
6:
7:
8:
9: