Scripts (on linux) don't function unless they have the extension .ps1 (generally, languages do not require specific extensions in Linux when using shebang to start them #! /usr/bin/powershell
Steps to reproduce
File: myscript
#!/usr/bin/powershell
echo hi
chmod a+x ./myscript
# hangs!
./myscript
mv ./myscript ./myscript.ps1
# works
./myscript.ps1
hi
Expected behavior
On linux, this should work even if the extension isn't .ps1
Actual behavior
EDIT
it turns out it didn't hang, it fails:
System.TypeInitializationException: The type initializer for 'System.Management.Automation.PSVersionInfo' threw an exception. ---> System.IO.FileLoadException: Could not load file or assembly 'System.Reflection.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. An internal error occurred.
(Exception from HRESULT: 0x8007054F)
at System.Reflection.Internal.LightUpHelper.GetMethod(Type type, String name, Type[] parameterTypes)
at System.Reflection.Internal.MemoryMapLightUp.TryLoadMembers()
at System.Reflection.Internal.MemoryMapLightUp.get_IsAvailable()
at System.Reflection.Internal.StreamMemoryBlockProvider..ctor(Stream stream, Int64 imageStart, Int32 imageSize, Boolean isFileStream, Boolean leaveOpen)
at System.Reflection.PortableExecutable.PEReader..ctor(Stream peStream, PEStreamOptions options, Nullable`1 sizeOpt)
at System.Diagnostics.FileVersionInfo.TryLoadManagedAssemblyMetadata()
at System.Diagnostics.FileVersionInfo.GetVersionInfo(String fileName)
at System.Management.Automation.PSVersionInfo.GetBuildVersion()
at System.Management.Automation.PSVersionInfo..cctor()
--- End of inner exception stack trace ---
at System.Management.Automation.PSVersionInfo.get_PSVersion()
at System.Management.Automation.PSSnapInReader.ReadRegistryInfo(Version& assemblyVersion, String& publicKeyToken, String& culture, String& architecture, String& applicationBase, Version& psVersion)
at System.Management.Automation.PSSnapInReader.ReadCoreEngineSnapIn()
at System.Management.Automation.Runspaces.InitialSessionState.ImportCorePSSnapIn()
at System.Management.Automation.Runspaces.InitialSessionState.CreateDefault2()
at Microsoft.PowerShell.UnmanagedPSEntry.Start(String consoleFilePath, String[] args, Int32 argc)
at Microsoft.PowerShell.ManagedPSEntry.Main(String[] args)
Environment data
v0.4.0
Scripts (on linux) don't function unless they have the extension
.ps1(generally, languages do not require specific extensions in Linux when using shebang to start them#! /usr/bin/powershellSteps to reproduce
File:
myscript#!/usr/bin/powershell echo hiExpected behavior
On linux, this should work even if the extension isn't
.ps1Actual behavior
EDIT
it turns out it didn't hang, it fails:
Environment data
v0.4.0