How to count number of files in a directory and store that result in a variable?
How to count number of files in a directory and store that result in a variable?
count=ls -1 | wc -l
count=find ./ -name *.dat -type f | wc -l
I am using the above two queries both are returning the results but not storing that result in count variable. Value in count is always NULL. Please advise.
Thanks,
Usman.