PsBash

0.9.8

Real bash commands for PowerShell with typed objects. 76 commands (ls, grep, sort, awk, sed, jq, find, ps, du, tar, etc.) that accept real bash flags and return structured PowerShell objects while producing identical text output. Pipeline bridge pattern preserves typed objects through grep, sort, head, tail.

Minimum PowerShell version

7.0

Installation Options

Copy and Paste the following command to install this package using PowerShellGet More Info

Install-Module -Name PsBash

Copy and Paste the following command to install this package using Microsoft.PowerShell.PSResourceGet More Info

Install-PSResource -Name PsBash

You can deploy this package directly to Azure Automation. Note that deploying packages with dependencies will deploy all the dependencies to Azure Automation. Learn More

Manually download the .nupkg file to your system's default download location. Note that the file won't be unpacked, and won't include any dependencies. Learn More

Owners

Copyright

(c) Andy Brummer. All rights reserved.

Package Details

Author(s)

  • Andy Brummer

Tags

bash linux cross-platform cli grep awk sed jq pipeline typed-objects powershell-module devops unix shell commands windows macos

Functions

Compare-Version Complete-BashBgJob ConvertFrom-AwkProgram ConvertFrom-BashArgs ConvertFrom-HumanNumeric ConvertFrom-MonthName ConvertFrom-SimpleYaml ConvertFrom-YamlValue ConvertTo-BrowseRow ConvertTo-JqJson ConvertTo-PermissionString ConvertTo-SimpleYaml Disable-BashHookPrompt Emit-BashLine Enable-BashHookPrompt Expand-AwkString Expand-EscapeSequences Find-JqBranchKeyword Find-JqKeyword Find-JqTopLevelChar Find-JqTopLevelStr Format-AwkPrintf Format-BashDate Format-BashSize Format-LsGrid Format-LsLine Format-PsAuxLine Format-PsCustomLine Get-BashBgRunspacePool Get-BashFileInfo Get-BashItem Get-BashLsProviderEntries Get-BashPlatform Get-BashText Get-BrowseDisplayProperties Get-BrowseTargetText Get-DotNetProcEntry Get-JqMatchingBracket Get-LinuxProcEntry Get-LsDisplayName Get-LsEntryFromFsi Get-LsEntryFromPsItem Initialize-BrowseAdapters Invoke-AwkAction Invoke-BashAwk Invoke-BashBackground Invoke-BashBg Invoke-BashEcho Invoke-BashFg Invoke-BashJobs Invoke-BashKill Invoke-BashRedirect Invoke-BashSed Invoke-BashWait Invoke-BrowseAction Invoke-BrowseCommand Invoke-BrowseInteractive Invoke-JqFilter Invoke-JqIf Invoke-JqRecurse Invoke-JqSelect Invoke-ProcessSub Invoke-ProcessSubPipeline Invoke-ProcessSubString New-BashObject New-BrowseAction New-BrowseAdapter New-BrowseBinding New-BrowseSafetyPreview New-FlagDefs Open-BashFileReader Read-AwkBlock Read-BashFileBytes Read-BashFileLines Read-BashFileRaw Read-BashFileStreaming Register-BashCompletions Register-BashLsProvider Resolve-AwkExpression Resolve-AwkStringFunc Resolve-BashGlob Resolve-BrowseAdapter Resolve-JqDotPath Resolve-JqStringInterpolation Set-BashDisplayProperty Set-BashErrorMode Show-BashHelp Split-AwkFields Split-AwkFuncArgs Split-AwkStatements Split-JqComma Split-JqPipe Test-AwkPattern Test-BashCondition Test-BashHelpFlag Test-BrowseCommandRequiresConfirmation Write-BashError Write-BashFileRaw Write-BashFileText Write-BashHostStderr

PSEditions

Core

Dependencies

This module has no dependencies.

Release Notes

v0.9.7: CI hardening and cross-platform parity. Detach ps-bash-host inherited stdio (dup2 /dev/null over fds 0/1/2 + close inherited pipe fds 3+) so the daemon never holds the launcher pipe write ends open across Linux/macOS test runners (this fix lifted the indefinite-hang quarantine on PsBash.Differential.Tests / PsBash.Canary.Tests / PsBash.Escalation.Tests). Fix three Pester regressions: less alias missing from AliasesToExport, Invoke-BashPwd StrictMode crash on undefined $global:__PsBashCwd, and Invoke-BashPwd path-collapse on macOS due to preferring $env:PWD over (Get-Location).Path. Fix CommandNotFoundException not propagating to $LASTEXITCODE; ps-bash now returns exit 127 like bash. Fix Invoke-BashSource silent failure on missing files (now sets $LASTEXITCODE=1 and writes a diagnostic). Fix PS1 \\w / \\W using Windows-style backslashes on POSIX. Fix here-string and heredoc body missing trailing newline (cat <<< \"hello\" now produces \"hello\\n\"). Tag every line of multi-line PSBASH_DEBUG output so AssertOracle.StripDebugLines does not leak transpile content into differential stderr comparison. Parser: \"done\" reserved only as first word of a simple command (per bash man) so \"echo done\" no longer drops the argument. macOS TerminalMode probe now exercises ICANON (was Linux-only, ICANON bit value differs). HostCommandTests endpoint name shortened to fit macOS AF_UNIX 104-char limit. Canary tests use [SkippableFact] so Skip.If actually skips. ProcessRunHelper passes -c $Configuration to dotnet run so Escalation tests resolve the Release launcher. CI workflows gain paths-ignore (.dartai/**, docs/spikes, **/*.md) + concurrency.cancel-in-progress + --blame-hang-timeout + timeout-minutes caps. v0.9.6: Add host management commands (ps-bash host status/shutdown/restart), implement cd as an emitter builtin with $env:PWD tracking, fix pwd to honor __PsBashCwd and .NET CurrentDirectory, detect stale host processes when the binary has been reinstalled, harden eval depth probe for set -u compatibility, wrap statement-style emitter output in $() for pipeline chains, fix CtrlRSearch alternate-screen restore idempotency, guard PSObjectFormatter against missing properties, suppress IL2026 trim warnings in the host, and add AOT-compatible JSON serialization for HostMetadata. v0.9.5: Remove the legacy script-worker path, run the launcher exclusively through ps-bash-host/SdkWorker, and fix SDK object output to emit BashText for ls-style records instead of PSObject serialization. v0.9.4: Patch release for cmdlet packaging and host IPC hardening. Stages the built PsBash.Cmdlets binary for PSGallery publishing, keeps Invoke-BashEval behind the experimental build flag, and simplifies host transport startup paths. v0.9.1: Memory and error-loop hardening. SdkWorker streams output via PSDataCollection.DataAdded instead of buffering Collection<PSObject>; DataAdded handler stops the pipeline on callback failure instead of looping into a broken sink. RunCommandCollect capped at 4 MB. HostProtocol.StreamLineReader enforces a 1 MB max-line guard against malformed IPC frames. HostServer accept loop adds a 10 ms delay on error to prevent CPU busy-spin. Background memory watcher now wraps its poll body in try/catch so a transient failure cannot silently kill the watcher. jq pipe/comma/recurse/path accumulation converted from O(n^2) PS array += to List[object].Add/AddRange. v0.9.0: Two-binary IPC host architecture. ps-bash is now a small AOT launcher that delegates PowerShell execution to a long-lived ps-bash-host daemon over a named-pipe (Windows) / Unix-domain-socket (Linux/macOS) transport. The host hosts a single Microsoft.PowerShell.SDK runspace shared across connections, eliminating per-invocation pwsh startup cost (~250ms) and enabling state persistence for set -e / positional params / hooks across -c invocations. Idle shutdown (PSBASH_HOST_IDLE_SECS, default 600s) and parent-death watchdog ensure the host exits when the launcher does. Distributions now ship both ps-bash and ps-bash-host in the same archive. v0.8.20: Publish PsBash.Cmdlets binary module to PSGallery alongside PsBash. PsBash.Cmdlets provides Invoke-BashEval, Invoke-BashSource, ConvertTo-PowerShell, and Test-BashSyntax cmdlets. Install-Module PsBash.Cmdlets automatically pulls in PsBash as a dependency. v0.8.17: LineEditor — fix right-arrow suggestion acceptance and refactor redraw pattern for safety. v0.8.16: Fix manifest to not export Invoke-BashEval/Invoke-BashSource as functions (they are binary cmdlets). v0.8.15: Error rewriting - map pwsh runtime errors back to bash line numbers. v0.8.14: Parse-time eval — `eval ARG` is now resolved by PsEmitter at transpile time: arg word parts are reconstructed into the bash source eval would see, which is re-parsed and emitted inline. Static bodies (literals, quoted literals, variable references) fold into normal pwsh with no runtime eval cmdlet. Dynamic bodies — `eval "$(cmd)"`, `eval `cmd``, `eval $((expr))`, `eval <(cmd)` — are rejected at transpile time with a clear message telling the user to inline the command's output, instead of the prior behavior where rc sourcing hung past its timeout on nested ps-bash subprocess spawns. Also: route -c through InteractiveShell.ExpandAliases before transpile for REPL parity, with regression tests for `-c "... --<word> ..."` where `<word>` starts with a recognized short-flag letter. PSBASH_TEST_TIMEOUT wall-clock cap for test.sh. Shell test harness always closes child stdin for clean EOF. install-local.ps1 applies the NTFS rename-to-.old trick to every locked file, not just ps-bash.exe, so a live shell holding Core.dll no longer blocks redeploy. v0.8.13: Bash CLI compatibility for Claude Code wrappers (bundled -lc, -c -l cmd interleaving). Fix three transpiler bugs in Claude prelude (cmd || true, >|, < /dev/null). Add --unix-paths flag and PSBASH_UNIX_PATHS env var for opt-in MSYS drive-path translation. Hide child console windows when ps-bash is spawned by a GUI/Node parent. Interactive shell startup loading indicator and console-input restore after foreground children. v0.8.12: Replace all silent catch blocks with stderr logging. Fix sequence suggestion test. v0.8.10: Fix flaky background-job Pester tests and child-process module loading for CI stability. v0.8.9: Add install alias to module manifest. v0.8.8: Fix Ctrl+C in shell mode, ANSI prompt after git pull, install command, --noprofile flag, PATH command resolution, cursor redraw, history deduplication. v0.8.7: Direct execution for interactive external commands (claude, copilot, etc.). v0.8.6: Skip ps -u USER on non-Windows CI. v0.8.5: Skip ps -u USER on Linux CI. v0.8.4: Add missing Set-Alias for balias. v0.8.3: Remove PsBuiltinAliases, combined flag parsing, ls -F/-A/--color, interactive shell, rm nul guard.

FileList

Version History

Version Downloads Last updated
0.9.8 (current version) 0 5/20/2026
0.8.20 15 4/22/2026
0.8.19 4 4/22/2026
0.8.18 4 4/22/2026
0.8.17 3 4/21/2026
0.8.16 3 4/21/2026
0.8.14 9 4/20/2026
0.8.12 5 4/16/2026
0.8.11 3 4/16/2026
0.8.10 5 4/15/2026
0.8.7 3 4/14/2026
0.8.6 3 4/14/2026
0.7.6 5 4/12/2026
0.7.5 4 4/12/2026
0.7.4 3 4/12/2026
0.7.3 5 4/10/2026
0.7.2 3 4/10/2026
0.7.1 4 4/10/2026
0.7.0 5 4/9/2026
0.4.0 13 4/5/2026
0.3.0 4 4/4/2026
0.2.0 347 4/3/2026
0.1.0 94 4/3/2026
Show more