bash - Wc and reading from a file -


i want check number of lines of file without using temporary file using wc. tried using this: var=${wc -l a.txt} or wc -l a.txt | read line both didn't work.

the way store output of command var=$(command) instead of var=${command} used.

hence, do:

var=$(wc -l a.txt)    # returns xx a.txt 

to store number, do

var=$(wc -l < a.txt)  # returns xx             ^ 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -