$ bash <<EOF
read -p 'This will not work' input
EOF
因为
$ cat script
read -p 'This will work fine' input
$ bash script
This will work fine
什么区别感到困惑?这似乎是一种标准行为,因为ash
的行为方式完全相同。
根据迄今为止提供的答案,我怀疑(并确认)下列作品。我认为这实际上是我一直想做的事情,但<()
语法总是我忘记的一种。
$ bash <(cat <<EOF
read -p 'This works' input
EOF
)