Setting Global Variable in Bash Function Output Piped to Next Command