26 Jul
2022
26 Jul
'22
12:25
Obviously I've reduced and rewitten it to better point out the problem in this script. The question is, how should the variable "count" be declared so that it isn't treated as two, completely different variables (with exactly the same name)? If you want to try to run it, it takes a filename as an commandline argument. ======================== #!/bin/bash #How to declare the variable "count"??? count=0 cat $1 | while read line do count=$((count+1)) echo -n "$count " done echo echo File $1 has $count lines. ======================== Thanks.