• This is true for Bash scripts, but not for POSIX shell scripts.

    % /bin/sh --version
    GNU bash, version 3.2.57(1)-release (arm64-apple-darwin26)
    Copyright (C) 2007 Free Software Foundation, Inc.
    
    ~% /bin/sh <<EOF
    heredoc> alias x=echo
    heredoc> x hello
    heredoc> EOF
    hello
    

    (Bash runs in POSIX mode when invoked as sh)


    score 1 · canonical