```bash
#!/bin/sh

A=0
B=0

for i in $(seq 10); do
    ASAN_OPTIONS="detect_leaks=1" ./a.out 2> /dev/null
    if [[ $? -eq 0 ]]; then
        A=$(($A+1))
    else
        B=$(($B+1))
    fi
done

echo "No leak detected $A times"
echo "Leak detected $B times"
```

Output: 

```
~/c/test$ ./test.sh  
No leak detected 5 times
Leak detected 5 times
~/c/test$ ./test.sh
No leak detected 2 times
Leak detected 8 times
~/c/test$ ./test.sh
No leak detected 6 times
Leak detected 4 times
```