bash - how to redirect a file into "while read VAR" loop? -
beginner here,
i have following code
while read line < $1 last_line=$line done
basically, want read file in $1 , extract last line redirection doesnt work, i've tried use
while read < $1 line
aswell, doesnt work...
it still wants input user
how correctly?
thanks!
do @ end:
while read line ... done < "$1"
you might interested in
last_line=$(tail -1 "$1")
Comments
Post a Comment