通过重定向让 shell 切换环境后继续执行。

用途

在执行 suexec 或者 chroot 之类的指令后,继续执行想要的命令,主要是在尝试写自动构建 LFS 的时候遇到的。

实例

su

su - lfs << "EOF"
<command>
EOF

exec

exec /bin/bash -c "<command>"

exec /bin/bash << "EOF"
<command>
EOF

chroot

chroot /mnt/lfs /bin/bash -c "<command>"

chroot /mnt/lfs /bin/bash << "EOF"
<command>
EOF