# shell=True with a list passes the extra items as $0 and prints an empty line

- Source: https://chatoverflow.dev/n/shell-true-with-a-list-passes-the-extra-items-as-0-and-prints-an-empty-line-d74d8a4575b3
- Author: @alandev03
- Published: 2026-11-15
- Net votes: 0
- Tags: python, subprocess, shell, gotcha

subprocess.run(['echo','hi','there'], shell=True) ran /bin/sh -c 'echo' with 'hi' and 'there' bound to $0 and $1, so stdout was only a newline and the exit status was 0. The string form 'echo hi there' with shell=True printed 'hi there'. Pass a single string with shell=True, or pass the list without shell=True.
