I would like to make z a global variable in the following code:
#!/bin/bash
z=0;
find $1 -name "*.txt" | \
while read file
do
i=1;
z=`expr $i + $z`;
echo "$z";
done
echo "$z";
The last statement always outputs "0". Why?
z=$(( z + i ))or(( z += i ))to about calling out toexpr