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
Post a Comment