0

I am experiencing issues with Read-Host when I am trying to read input from file

Let's say I create a file read.pwsh having the following contents

$a = Read-Host;

and there is input file input.in having the following content

hello

After executing command on terminal pwsh read.pwsh < input.in

then I am getting the following output hello The above behaviour seems to be incorrect

Expected behavior

pwsh read.pwsh < input.in

this should not print anything

Actual behavior

pwsh read.pwsh < input.in

the input is getting printed

Environment data

OS Details        :  Ubuntu 16.04.4 LTS
Poweshell Version :  PowerShell 6.2.2
rjohari23
  • 119
  • 9

1 Answers1

0

I'm not an advanced user of powershell, but the script should have the extension .ps1. I see you using pwsh as an extension and I think that the system cannot read the file correctly.