Title: PowerShell Scripts require .ps1 extension · Issue #1103 · PowerShell/PowerShell · GitHub
Open Graph Title: PowerShell Scripts require .ps1 extension · Issue #1103 · PowerShell/PowerShell
X Title: PowerShell Scripts require .ps1 extension · Issue #1103 · PowerShell/PowerShell
Description: 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/...
Open Graph Description: 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...
X Description: 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 S...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/1103
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"PowerShell Scripts require .ps1 extension","articleBody":"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`\n## Steps to reproduce\n\nFile: `myscript`\n\n``` powershell\n#!/usr/bin/powershell\necho hi\n```\n\n``` bash\nchmod a+x ./myscript\n\n# hangs!\n./myscript \n\n\nmv ./myscript ./myscript.ps1\n\n# works\n./myscript.ps1\nhi\n\n```\n## Expected behavior\n\nOn linux, this should work even if the extension isn't `.ps1`\n## Actual behavior\n\n**EDIT** \nit turns out it didn't hang, it fails:\n\n``` text\nSystem.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.\n (Exception from HRESULT: 0x8007054F)\n at System.Reflection.Internal.LightUpHelper.GetMethod(Type type, String name, Type[] parameterTypes)\n at System.Reflection.Internal.MemoryMapLightUp.TryLoadMembers()\n at System.Reflection.Internal.MemoryMapLightUp.get_IsAvailable()\n at System.Reflection.Internal.StreamMemoryBlockProvider..ctor(Stream stream, Int64 imageStart, Int32 imageSize, Boolean isFileStream, Boolean leaveOpen)\n at System.Reflection.PortableExecutable.PEReader..ctor(Stream peStream, PEStreamOptions options, Nullable`1 sizeOpt)\n at System.Diagnostics.FileVersionInfo.TryLoadManagedAssemblyMetadata()\n at System.Diagnostics.FileVersionInfo.GetVersionInfo(String fileName)\n at System.Management.Automation.PSVersionInfo.GetBuildVersion()\n at System.Management.Automation.PSVersionInfo..cctor()\n --- End of inner exception stack trace ---\n at System.Management.Automation.PSVersionInfo.get_PSVersion()\n at System.Management.Automation.PSSnapInReader.ReadRegistryInfo(Version& assemblyVersion, String& publicKeyToken, String& culture, String& architecture, String& applicationBase, Version& psVersion)\n at System.Management.Automation.PSSnapInReader.ReadCoreEngineSnapIn()\n at System.Management.Automation.Runspaces.InitialSessionState.ImportCorePSSnapIn()\n at System.Management.Automation.Runspaces.InitialSessionState.CreateDefault2()\n at Microsoft.PowerShell.UnmanagedPSEntry.Start(String consoleFilePath, String[] args, Int32 argc)\n at Microsoft.PowerShell.ManagedPSEntry.Main(String[] args)\n\n```\n## Environment data\n\nv0.4.0\n","author":{"url":"https://github.com/fearthecowboy","@type":"Person","name":"fearthecowboy"},"datePublished":"2016-06-14T16:25:15Z","url":"https://github.com/PowerShell/PowerShell/issues/1103"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4e7e6ae0-fa0b-d475-b9de-60b7326f01b5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ADA2:3B38CF:25E8ACA:34DDDC2:6AFD431F |
| html-safe-nonce | 346e5abb8a7520e846944ca149b84d61e117d0d10237cd69452cb235a26f2df2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBREEyOjNCMzhDRjoyNUU4QUNBOjM0REREQzI6NkFGRDQzMUYiLCJ2aXNpdG9yX2lkIjoiNDA2Mjc1NDgwMTQwMDQ5NjkyNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 63009a7e1acc6e049474d8477c0b2d028c8aad4e932155fa987ba3f0c87ce6a6 |
| hovercard-subject-tag | issue:160225324 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/1103/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9d1c175e9ec3e1b3aa64077b2ce4f615bc2497a2e1925cca0cb4b4435a6e22ea/PowerShell/PowerShell/issues/1103 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9d1c175e9ec3e1b3aa64077b2ce4f615bc2497a2e1925cca0cb4b4435a6e22ea/PowerShell/PowerShell/issues/1103 |
| og:image:alt | 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... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | fearthecowboy |
| hostname | github.com |
| expected-hostname | github.com |
| None | bdbacc25b921224ff0befcb9e629560a1255be51aec9991d6e3f95b5e9151474 |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 556dd37bb0aceffb25724e151b5d858b3265b40b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width