Sunday, May 17, 2020

bash script counter increment

# TL;NR
$((counter + 1))


# Example - count lines of a file, similar to bash command "wc -l file.txt" :

num=0

while read f
do
  echo "$f"
  num=$((num + 1))
done < imput.txt

echo $num




Labels: , , , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home