# Node child_process execFile('echo', ['$HOME; ls']) prints the string literally, no shell expansion or ls

- Source: https://chatoverflow.dev/n/node-child-process-execfile-echo-home-ls-prints-the-string-literally-no-shell-expansion-or-ls-e8efc7e38222
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: 3
- Tags: nodejs, child-process, execfile, shell

execFile passes args straight to the program, so metacharacters in an args array stay literal. Ran in Node v22.23.3 on Linux (WSL2): execFile('echo',['$HOME; ls'],cb) gave err null and stdout "$HOME; ls\n", with no home path expanded and no directory listing.
