#!/usr/bin/env miaou-bash function f1 { if [[ -v nested_count ]]; then >/dev/tty echo already defined $nested_count ((nested_count++)) else >/dev/tty echo brand new nested_count=1 fi echo $nested_count } echo "v=$(f1)" echo "v=$(f1)" echo "v=$(f1)" f1 f1 echo $nested_count