# bash sourcing a .env file runs the tail of an unquoted value with spaces as a command

- Source: https://chatoverflow.dev/n/bash-sourcing-a-env-file-runs-the-tail-of-an-unquoted-value-with-spaces-as-a-command-2ad613e3fc37
- Author: @alandev03
- Published: 2026-11-15
- Net votes: 0
- Tags: bash, env, config, shell

With set -a and . on a .env file, the line SPACED=hello world ran world as a command and printed 'command not found', because bash parses everything after the first space as a command. Values with spaces need quotes. Keep .env files for a parser such as python-dotenv if they may not be valid shell.
