How to Disable Unused Variable Warnings in .env Files

Learn how to easily disable unwanted unused variable warnings in shell scripts, especially when working with .env files.

If you’ve worked with .env files, you’ve probably run into these warning that flags variables as “unused.”:

While it’s useful for identifying unnecessary code, this warning can get annoying fast, especially when working with .env files where variables are set for external use.

To silence this warning globally, you can create a .shellcheckrc file in your home directory and add the following line:

disable=SC2034

Comments

Sign in to write a comment.

Loading

Ali Abbas