Introduction
Environment variables store information for the system and other programs, while local variables store data only inside a script or shell session.
When you want to share a setting or path with multiple programs, use environment variables.
When you need a temporary value only inside your script, use local variables.
When you want to keep data private to your script and not affect other programs, use local variables.
When you want to configure your shell or programs globally, use environment variables.
When testing or debugging a script, use local variables to avoid changing system settings.