Bash Script Variable Scope If Statement