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)
- exit status `0` on syntax errors, when reading scrip from stdin HOT 4
- `$ErrorActionPreference = 'Stop'` ignored, when command read from stdin. HOT 12
- `-CommandWithArgs` CLI parameter doesn't work with `-` (code provided via stdin)
- fwlink helpURI of Get-Uptime,Get-FileHash and others doesn't work HOT 5
- Unable to Install PowerShell 7.4 with Ubuntu 24.04 HOT 6
- Incorrect Auto-Completion When Using Tab HOT 4
- Mount-DiskImage does not assign driver letter every third time HOT 2
- Does PowerShell support the real "Stream" response? HOT 5
- v7.4.2 not in Ubuntu 22.04 Linux package repository for Microsoft products HOT 3
- `Finally` block isn't executed upon Ctrl+C HOT 36
- Make `ConvertFrom-StringData` more error tolerant HOT 9
- Add-Type ReferencedAssemblies only works with full file paths now? HOT 1
- .Net 8 in PowerShell 7 System.Private.CoreLib fails to register. HOT 41
- `ConvertFrom-StringData` mistakenly emits a statement-terminating error when one of its input strings isn't well-formed HOT 2
- Redirection operator `>` should not be hardcoded to files HOT 6
- Update from System.Data.SqlClient to Microsoft.Data.SqlClient HOT 3
- .NET App using Powershell.SDK fails to run, when building as SingeFile HOT 2
- Add a command which gets the System Lockdown mode information HOT 2
- Overriding .NETs ToString() method can cause unexpected behaviour when using Transcripts HOT 1
- `Compare-Object` doesn't compare custom value types (`structs`) (that don't implement `IComparable`) correctly HOT 4
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.