8000 pwsh -nologo or -noprofile do not appear to work within script 'shebang' line · Issue #8217 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content

pwsh -nologo or -noprofile do not appear to work within script 'shebang' line #8217

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dorkcoder opened this issue Nov 9, 2018 · 1 comment
Labels
Resolution-Duplicate The issue is a duplicate.

Comments

@dorkcoder
Copy link

I am trying to execute a .ps1 script under PowerShell Core 6.1 (CentOS Linux 7) using the Unix method of specifying '/usr/bin/pwsh' in the script's 'shebang' line like this:

myscript.ps1:

#!/usr/bin/pwsh -NoLogo -NoProfile

###...script content follows below...###

When I try to invoke the above script from the Linux shell command line, pwsh reports the below error:

The argument '-NoLogo -NoProfile' is not recognized as the name of a script file. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

It appears that the call to 'pwsh' along with its command arguments is being misinterpreted here and that might be leading to the error.

Question: Other than invoking the script using 'pwsh -NoLogo -NoProfile -f myscript.ps1' approach (which works fine), is there some way we could specify the command arguments to pwsh within the script itself (perhaps using escape characters in some manner)?

Environment data

Name                           Value
----                           -----
PSVersion                      6.1.0
PSEdition                      Core
GitCommitId                    6.1.0
OS                             Linux 3.10.0-862.11.6.el7.x86_64 #1 SMP Tue Aug 14 21:49:04 UTC 2018
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

@iSazonov
Copy link
Collaborator
iSazonov commented Nov 9, 2018

@dorkcoder Thanks for your report! It is dup #8072.

@iSazonov iSazonov added the Resolution-Duplicate The issue is a duplicate. label Nov 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution-Duplicate The issue is a duplicate.
Projects
None yet
Development

No branches or pull requests

3 participants
0