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

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -