René's URL Explorer Experiment


Title: Align PowerShell's CLI / startup behavior with POSIX-like shells such as Bash - command-line arguments · Issue #3743 · PowerShell/PowerShell · GitHub

Open Graph Title: Align PowerShell's CLI / startup behavior with POSIX-like shells such as Bash - command-line arguments · Issue #3743 · PowerShell/PowerShell

X Title: Align PowerShell's CLI / startup behavior with POSIX-like shells such as Bash - command-line arguments · Issue #3743 · PowerShell/PowerShell

Description: This is a follow-up to #3600. To make PowerShell fit into the world of POSIX-like shells on Unix platforms, so that it can be a viable alternative, it must: support certain command-line parameters (options) exhibit certain default behavi...

Open Graph Description: This is a follow-up to #3600. To make PowerShell fit into the world of POSIX-like shells on Unix platforms, so that it can be a viable alternative, it must: support certain command-line parameters ...

X Description: This is a follow-up to #3600. To make PowerShell fit into the world of POSIX-like shells on Unix platforms, so that it can be a viable alternative, it must: support certain command-line parameters ...

Opengraph URL: https://github.com/PowerShell/PowerShell/issues/3743

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Align PowerShell's CLI / startup behavior with POSIX-like shells such as Bash - command-line arguments","articleBody":"\u003csup>This is a follow-up to #3600.\u003c/sup>\r\n\r\nTo make PowerShell fit into the world of POSIX-like shells on Unix platforms, so that it can be a viable alternative, it must: \r\n* support certain command-line parameters (options) \r\n* exhibit certain default behaviors on startup\r\n\r\nThe [POSIX spec for the `sh` utility](http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html) prescribes both.\r\n\r\nDefinitely not everything there is applicable to PowerShell, but I think it's important to at least fundamentally exhibit the same behavior and to document to what extent PowerShell is compliant.\r\n\r\nA step has been made in the right direction by adding support for `-i` to start an interactive session - see #3558 \r\n\r\nMore work is needed, _some of which would result in breaking changes_.\r\n\r\nThe list is not complete, but hopefully covers the most important aspects.\r\n\r\n* POSIX-like shells default to _not_ loading any initialization files _when commands are passed_ (whether via stdin or via `-c`), whereas PowerShell _always_ loads its profiles, the only exception being  explicit suppression with `-NoProfile`.\r\n\r\n   * The POSIX behavior is the more sensible default: it makes for a more predictable execution environment and doesn't incur the cost of sourcing the initialization files.\r\n   * Aligning PowerShell with this behavior would be a _breaking change_.\r\n   * Arguably, when commands are combined with `-NoExit`, the profiles should still be loaded by default (note that this ability to execute commands on startup _and_ keep the shell open for interactive use is unique to PowerShell: POSIX-like shells invariably _exit_ after executing commands).\r\n   * See #992, which has a [green-lit, but never-implemented committee decision](https://github.com/PowerShell/PowerShell/issues/992#issuecomment-384455760) to implement a _separate_ CLI entry point that doesn't load profiles, `pwsh-np`\r\n\r\n* PowerShell already reads commands from stdin by default, and also when `-Command -` (which arguably should be `-File -`) is specified, but:\r\n   * `-s` is the POSIX option for explicitly specifying standard input, and should be supported too.\r\n   * `-s` allows combining stdin command input with passing _parameters_, which PowerShell doesn't support; for instance, `bash` supports something like:   \r\n`echo 'echo \"$# params\"' | bash -s one two`, which yields `2 params`.\r\n\r\n* `-Command` and `-File` issues:\r\n  * They exhibit problematic interactive shell-like behaviors (with or without `-NonInteractive`) and lack consistent argument support - see #3223.\r\n\r\n  * The way `-Command` currently parses the remaining arguments is problematic in itself and also fundamentally incompatible with POSIX-like shells - see https://github.com/PowerShell/PowerShell/issues/4024#issuecomment-311541803\r\n\r\n  * [x] [Fixed by #4178] `-File` currently makes it impossible to pass Boolean values - see #4036.\r\n\r\n* [_This is already the case_] ~~`-c` must be locked in as an alias for `-Command`, so that future additions of -c* parameters don't break `-c` due to ambiguity.~~\r\n\r\n* `-i` works now, but no error occurs when it is combined with `-NonInteractive`, even though they directly contradict each other.\r\n  * Note that starting a POSIX-like shell _without operands_ in a _terminal_ (with stdin and stderr connected to a terminal) _implies_ `-i` (and therefore loading of the initialization files).\r\n  * Note that `-NonInteractive` doesn't prevent an interactive session per se, only in-session interactive features such as `Read-Host` and confirmation prompts.\r\n\r\n* [x] [Fixed by #9528] `-l` should be supported and trigger loading of the profiles - see #3600 for background.\r\n  * `-l` is not part of POSIX, but supported by all major POSIX-like shells (`bash`, `dash`, `ksh`, and `zsh`)\r\n  * `-l` is for creating a _login_ shell - which some platforms use by default (macOS); on Unix, only special contexts such as `ssh` sessions use them routinely.\r\n  * Login shells load a separate set of initialization files compared to interactive non-login shells, but PowerShell has no distinction between login and non-login shells.\r\n  * See https://github.com/PowerShell/PowerShell-RFC/pull/171/files for proposed changes to make PowerShell behave more like POSIX-like login shells.\r\n\r\n* [x] [Implemented with #4019] Passing a _positional argument_ should be interpreted as the _filename of a script to execute_ rather than a _shell command_.\r\n\r\n   * In PowerShell terms: A positional argument should bind to `-File`, not `-Command` - this would be a breaking change, but would facilitate proper handling of shebang lines - see #3963\r\n\r\n   * Conversely, to pass arbitrary shell commands, explicit use of `-Command` / `-c` should be required.\r\n\r\nCurrent as of PowerShell 7.3.1\r\n","author":{"url":"https://github.com/mklement0","@type":"Person","name":"mklement0"},"datePublished":"2017-05-09T15:00:37Z","url":"https://github.com/PowerShell/PowerShell/issues/3743"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:06674264-0691-40fc-6810-44bcf24b59a5
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idCD5E:31688C:99A17:D1494:6AFD3DFD
html-safe-noncec429d813945286c20defddfc5bc4d75150149de109d51b83a5d7dd191af69460
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRDVFOjMxNjg4Qzo5OUExNzpEMTQ5NDo2QUZEM0RGRCIsInZpc2l0b3JfaWQiOiI5MDE1NjY1MTkxMTI3MTcwNTU3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmace2c551a65dac1dbef2039e184147948ce1713127b3067726beec17f9b13fb4f1
hovercard-subject-tagissue:227396298
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/3743/issue_layout
twitter:imagehttps://opengraph.githubassets.com/55bb0c30f860a5f91873b38000e0eea9f5fed9209ef955b63ef9bd7b797e3534/PowerShell/PowerShell/issues/3743
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/55bb0c30f860a5f91873b38000e0eea9f5fed9209ef955b63ef9bd7b797e3534/PowerShell/PowerShell/issues/3743
og:image:altThis is a follow-up to #3600. To make PowerShell fit into the world of POSIX-like shells on Unix platforms, so that it can be a viable alternative, it must: support certain command-line parameters ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemklement0
hostnamegithub.com
expected-hostnamegithub.com
Nonebdbacc25b921224ff0befcb9e629560a1255be51aec9991d6e3f95b5e9151474
turbo-cache-controlno-preview
go-importgithub.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git
octolytics-dimension-user_id11524380
octolytics-dimension-user_loginPowerShell
octolytics-dimension-repository_id49609581
octolytics-dimension-repository_nwoPowerShell/PowerShell
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id49609581
octolytics-dimension-repository_network_root_nwoPowerShell/PowerShell
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release556dd37bb0aceffb25724e151b5d858b3265b40b
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/PowerShell/PowerShell/issues/3743#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPowerShell%2Fissues%2F3743
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPowerShell%2Fissues%2F3743
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=PowerShell%2FPowerShell
Reloadhttps://github.com/PowerShell/PowerShell/issues/3743
Reloadhttps://github.com/PowerShell/PowerShell/issues/3743
Reloadhttps://github.com/PowerShell/PowerShell/issues/3743
PowerShellhttps://github.com/PowerShell
PowerShellhttps://github.com/PowerShell/PowerShell
Codehttps://github.com/PowerShell/PowerShell
Issues1.3k (1.3k)https://github.com/PowerShell/PowerShell/issues
Pull requests364 (364)https://github.com/PowerShell/PowerShell/pulls
Discussionshttps://github.com/PowerShell/PowerShell/discussions
Actionshttps://github.com/PowerShell/PowerShell/actions
Projectshttps://github.com/PowerShell/PowerShell/projects
Security and quality3 (3)https://github.com/PowerShell/PowerShell/security
Insightshttps://github.com/PowerShell/PowerShell/insights
https://github.com/PowerShell/PowerShell
New issuehttps://github.com/login?return_to=https://github.com/PowerShell/PowerShell/issues/3743
New issuehttps://github.com/login?return_to=https://github.com/PowerShell/PowerShell/issues/3743
Align PowerShell's CLI / startup behavior with POSIX-like shells such as Bash - command-line argumentshttps://github.com/PowerShell/PowerShell/issues/3743#top
Breaking-Changebreaking change that may affect usershttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Breaking-Change%22
Committee-ReviewedPS-Committee has reviewed this and made a decisionhttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Committee-Reviewed%22
Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifhttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Discussion%22
Issue-Metaan issue used to track multiple issueshttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Meta%22
Resolution-No ActivityIssue has had no activity for 6 months or morehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Resolution-No%20Activity%22
https://github.com/mklement0
Michael Klement (mklement0)https://github.com/mklement0
on May 9, 2017https://github.com/PowerShell/PowerShell/issues/3743#issue-227396298
#3600https://github.com/PowerShell/PowerShell/issues/3600
POSIX spec for the sh utilityhttp://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html
#3558https://github.com/PowerShell/PowerShell/pull/3558
#!/usr/local/bin/powershell bang should not load profile #992https://github.com/PowerShell/PowerShell/issues/992
green-lit, but never-implemented committee decisionhttps://github.com/PowerShell/PowerShell/issues/992#issuecomment-384455760
CLI: pwsh -Command - and pwsh -File - unexpectedly exhibit pseudo-interactive behavior, lack support for argument passing #3223https://github.com/PowerShell/PowerShell/issues/3223
Command line arguments with a dollar sign #4024 (comment)https://github.com/PowerShell/PowerShell/issues/4024#issuecomment-311541803
Allow passing $true/$false as parameter to script using -File #4178https://github.com/PowerShell/PowerShell/pull/4178
Executing powershell script with bool parameter doesnt work #4036https://github.com/PowerShell/PowerShell/issues/4036
Add support for -l to pwsh so that it is compatible with POSIX shell expectations #9528https://github.com/PowerShell/PowerShell/pull/9528
Support -l for pwsh.exe #3600https://github.com/PowerShell/PowerShell/issues/3600
https://github.com/PowerShell/PowerShell-RFC/pull/171/fileshttps://github.com/PowerShell/PowerShell-RFC/pull/171/files
Change positional parameter for powershell.exe from -Command to -File #4019https://github.com/PowerShell/PowerShell/pull/4019
shebang without .ps1 extension ends up in recursive loop calling powershell #3963https://github.com/PowerShell/PowerShell/pull/3963
Nexthttps://github.com/PowerShell/PowerShell/issues/3743?timeline_page=1
https://github.com/iSazonov
Ilya (iSazonov)https://github.com/iSazonov
on May 9, 2017https://github.com/PowerShell/PowerShell/issues/3743#issuecomment-300223229
Ilya (iSazonov)https://github.com/iSazonov
Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifhttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Discussion%22
Issue-Metaan issue used to track multiple issueshttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Meta%22
on May 9, 2017https://github.com/PowerShell/PowerShell/issues/3743#event-1074933615
Steve Lee (SteveL-MSFT)https://github.com/SteveL-MSFT
on May 9, 2017https://github.com/PowerShell/PowerShell/issues/3743#event-1074986122
Steve Lee (SteveL-MSFT)https://github.com/SteveL-MSFT
Breaking-Changebreaking change that may affect usershttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Breaking-Change%22
on May 9, 2017https://github.com/PowerShell/PowerShell/issues/3743#event-1074987196
https://github.com/jpsnover
Jeffrey Snover (jpsnover)https://github.com/jpsnover
on May 12, 2017https://github.com/PowerShell/PowerShell/issues/3743#issuecomment-301133575
Steve Lee (SteveL-MSFT)https://github.com/SteveL-MSFT
on May 15, 2017https://github.com/PowerShell/PowerShell/issues/3743#event-1082769035
Steve Lee (SteveL-MSFT)https://github.com/SteveL-MSFT
on Nov 11, 2017https://github.com/PowerShell/PowerShell/issues/3743#event-1337263644
Steve Lee (SteveL-MSFT)https://github.com/SteveL-MSFT
Committee-ReviewedPS-Committee has reviewed this and made a decisionhttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Committee-Reviewed%22
Review - CommitteeThe PR/Issue needs a review from the PowerShell Committeehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Review%20-%20Committee%22
on Jan 3, 2018https://github.com/PowerShell/PowerShell/issues/3743#event-1408733753
https://github.com/SteveL-MSFT
Steve Lee (SteveL-MSFT)https://github.com/SteveL-MSFT
on Jan 3, 2018https://github.com/PowerShell/PowerShell/issues/3743#issuecomment-355159527
Steve Lee (SteveL-MSFT)https://github.com/SteveL-MSFT
6.1.0-Considerhttps://github.com/PowerShell/PowerShell/milestone/26
Futurehttps://github.com/PowerShell/PowerShell/milestone/48
on Jun 20, 2018https://github.com/PowerShell/PowerShell/issues/3743#event-1692129667
https://github.com/mi-hol
mi-holhttps://github.com/mi-hol
on Oct 30, 2019https://github.com/PowerShell/PowerShell/issues/3743#issuecomment-548063004
Steve Lee (@SteveL-MSFT)https://github.com/SteveL-MSFT
https://github.com/SteveL-MSFT
Steve Lee (SteveL-MSFT)https://github.com/SteveL-MSFT
on Oct 31, 2019https://github.com/PowerShell/PowerShell/issues/3743#issuecomment-548457492
mi-holhttps://github.com/mi-hol
https://github.com/apps/microsoft-github-policy-service
microsoft-github-policy-servicehttps://github.com/apps/microsoft-github-policy-service
on Nov 16, 2023https://github.com/PowerShell/PowerShell/issues/3743#issuecomment-1814125631
Microsoft GitHub Policy Servicehttps://aka.ms/1es-gitops
https://github.com/apps/microsoft-github-policy-service
microsoft-github-policy-servicehttps://github.com/apps/microsoft-github-policy-service
on Nov 16, 2023https://github.com/PowerShell/PowerShell/issues/3743#issuecomment-1814125636
Microsoft GitHub Policy Servicehttps://aka.ms/1es-gitops
microsoft-github-policy-servicehttps://github.com/apps/microsoft-github-policy-service
Resolution-No ActivityIssue has had no activity for 6 months or morehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Resolution-No%20Activity%22
on Nov 16, 2023https://github.com/PowerShell/PowerShell/issues/3743#event-10978408972
https://github.com/apps/microsoft-github-policy-service
microsoft-github-policy-servicehttps://github.com/apps/microsoft-github-policy-service
on Nov 16, 2023https://github.com/PowerShell/PowerShell/issues/3743#issuecomment-1814134456
Microsoft GitHub Policy Servicehttps://aka.ms/1es-gitops
https://github.com/apps/microsoft-github-policy-service
microsoft-github-policy-servicehttps://github.com/apps/microsoft-github-policy-service
on Nov 23, 2023https://github.com/PowerShell/PowerShell/issues/3743#issuecomment-1824500244
Microsoft GitHub Policy Servicehttps://aka.ms/1es-gitops
microsoft-github-policy-servicehttps://github.com/apps/microsoft-github-policy-service
Futurehttps://github.com/PowerShell/PowerShell/milestone/48
on Nov 23, 2023https://github.com/PowerShell/PowerShell/issues/3743#event-11048170945
microsoft-github-policy-servicehttps://github.com/apps/microsoft-github-policy-service
completedhttps://github.com/PowerShell/PowerShell/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Nov 23, 2023https://github.com/PowerShell/PowerShell/issues/3743#event-11048170978
Sign up for freehttps://github.com/signup?return_to=https://github.com/PowerShell/PowerShell/issues/3743
Sign in to commenthttps://github.com/login?return_to=https://github.com/PowerShell/PowerShell/issues/3743
Breaking-Changebreaking change that may affect usershttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Breaking-Change%22
Committee-ReviewedPS-Committee has reviewed this and made a decisionhttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Committee-Reviewed%22
Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifhttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Discussion%22
Issue-Metaan issue used to track multiple issueshttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Meta%22
Resolution-No ActivityIssue has had no activity for 6 months or morehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Resolution-No%20Activity%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.