Skip to content

Instantly share code, notes, and snippets.

@lengerfulluse
Created February 9, 2017 11:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lengerfulluse/f468666fad5a12953d65cda14c77ea47 to your computer and use it in GitHub Desktop.
Save lengerfulluse/f468666fad5a12953d65cda14c77ea47 to your computer and use it in GitHub Desktop.
#/bin/bash
loop=0
sum=0
str=`ls`
arr=($str)
while [ $loop -lt 100 ]; do
res=`wc -l ${arr[$loop]}`
line=`echo $res | cut -d' ' -f1`
echo $line
sum=$(($sum+$line))
loop=$(($loop+1))
done
echo "total sum is: $sum"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment