Read-Host 如果输入是从文件中给出的,则打印数据 | Ubuntu 16

问题描述

我在尝试从文件中读取输入时遇到 Read-Host 问题

假设我创建了一个包含以下内容的文件 read.pwsh

$a = Read-Host;

输入文件 input.in 的内容如下

hello

在终端执行命令后 pwsh read.pwsh

然后我得到以下输出 你好 上面的行为似乎是不正确的

预期行为

pwsh read.pwsh < input.in

this should not print anything

实际行为

pwsh read.pwsh < input.in

the input is getting printed

环境数据

OS Details        :  Ubuntu 16.04.4 LTS
Poweshell Version :  PowerShell 6.2.2

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)