Comments (10)
Is this a duplicate of #21402 ?
from powershell.
#!/bin/sh -e
It's more bourne itself, I don't want to have to look up the intricacies of $@
et cetera and any caveats involved with explicitly using pwsh's -File
, even if it turns out there are none for either. It's much simpler to just rename the script for now.
from powershell.
Is this a duplicate of #21402 ?
Looks like it.
They need to update the title with the real cause of the issue; the calling name ($args[0]
in other languages, eg $0
in bash) is missing the .ps1
is the cause.
Seems it's not so much the name of the actual script itself.
Keeping it "Symbolic links can change..." is impossible to search if you're closer to the real problem à la "...script missing .ps1 extension".
To add; I think what's really responsible is that $MyInvocation
has .MyCommand
listed as the whole script as a raw string, instead of the script as a file, when the extension is missing.
If MyCommand
isn't a file it cannot have a path.
from powershell.
Dup #4217
from powershell.
Dup #4217
Can't dupe a closed-due-to-inactivity issue.
"if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you"
from powershell.
#21402 did have a work around, creating a shell script without the extension adjacent to the powershell script with ps1
#!/bin/sh -e
exec pwsh -File "$0.ps1" "$@"
from powershell.
I've just resorted to keeping the .ps1
on the actual script instead of pushing args and input&output streams through an intermediary, and hopefully this'll get fixed one day.
It took forever for something huge like 1908 to get done, but it did get done!
from powershell.
instead of pushing input&output streams through an intermediary
Just so you know, the exec means no fork occurs and pwsh replaces sh with the same process id, environment, file descriptors etc. There is no intermediate.
from powershell.
This issue has been marked as duplicate and has not had any activity for 1 day. It has been closed for housekeeping purposes.
from powershell.
📣 Hey @Hashbrown777, how did we do? We would love to hear your feedback with the link below! 🗣️
🔗 https://aka.ms/PSRepoFeedback
from powershell.
Related Issues (20)
- Feature: Expose `Set-Location` history stack HOT 11
- Surrogate pairs cause misalignment in Format-Wide HOT 19
- Update behavior for getting wix 3.14 in CI.psm1 HOT 1
- is it defined/documented which newlines are used by Write-Host and Out-File HOT 8
- `Remove-Item` throws "Attempted to divide by zero" on PS 7.5.0-preview.3 HOT 6
- `using namespace` overrides previous `using namespace` uses as interactive HOT 8
- [Windows] No error when using a non-executable file in script line HOT 4
- `Remove-Item` reports incorrect number of removed items in the progress bar HOT 1
- Bug - PowerShell displays an error when loading in Windows Terminal HOT 5
- Show payload being sent when using verbose with Invoke-RestMethod and Invoke-WebRequest HOT 2
- Encode spaces with %20 instead of + when using Invoke-RestMethod and Invoke-WebRequest. HOT 15
- "foreach" alias poorly named, does not reproduce functionality and use cases with ForEach-Object HOT 7
- PowerShell community Power BI dashboard - Colors of Linux and MacOS are the same in graphs HOT 4
- pwsh 7.4.2 no-input unhandled exception -> process exit HOT 4
- CreateOutOfProcessRunspace fails to Open HOT 1
- `exit` does not return ExitCode when using #Requires -Module <ScriptModule> HOT 1
- pwsh Exception not serializable anymore HOT 5
- `Using Script` directive HOT 8
- Write-Information outputting twice with jobs and is it really Write-Host in disguise. HOT 1
- Unable to attach Visual Studio debugger to pwsh.exe process HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from powershell.