[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-109722":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":14,"stars30d":16,"stars90d":15,"forks30d":15,"starsTrendScore":17,"compositeScore":18,"rankGlobal":9,"rankLanguage":9,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":22,"hasPages":20,"topics":23,"createdAt":9,"pushedAt":24,"updatedAt":25,"readmeContent":26,"aiSummary":27,"trendingCount":15,"starSnapshotCount":15,"syncStatus":17,"lastSyncTime":28,"discoverSource":29},109722,"gash","hex2f\u002Fgash","hex2f","A fast, native, bash-compatible shell for Windows: a from-scratch drop-in replacement for Git Bash, written in Rust",null,"Rust",103,8,68,3,0,4,2,44.76,"MIT License",false,"main",true,[],"2026-11-17 13:23:46","2026-11-22 07:45:14","\u003Cimg src=\"assets\u002Fgash-icon.svg\" width=\"112\" height=\"112\" alt=\"gash icon\">\n\n# gash\n\n\u003Cpicture>\n  \u003Csource media=\"(prefers-color-scheme: dark)\" srcset=\"assets\u002Fspeed-dark.svg\">\n  \u003Cimg src=\"assets\u002Fspeed-light.svg\" width=\"100%\" alt=\"gash vs Git Bash in real time: each ball crosses its track once per run. gash's balls fly back and forth while Git Bash's barely move.\">\n\u003C\u002Fpicture>\n\nA fast, native, from-scratch **bash-compatible shell for Windows**, written in Rust with\nzero dependencies. It is a drop-in replacement for Git Bash's `bash.exe`: same syntax,\nsame `\u002Fc\u002FUsers\u002F...` paths, same MSYS tools (`ls`, `grep`, `sed`, `awk`, ... from Git for\nWindows), but without Cygwin's `fork()` emulation, which is what makes Git Bash slow.\n\n## Why it's fast\n\nGit Bash runs on the MSYS2\u002FCygwin runtime, which emulates `fork()` by copying the whole\nprocess. On Windows (especially with Defender scanning every new process) each fork\ncosts ~100–250 ms. Every `$(...)`, `( ... )`, pipeline stage and external command pays it.\n\ngash never forks:\n\n| Construct | Git Bash | gash |\n|---|---|---|\n| `$(...)`, `( ... )`, `\u003C( ... )` | fork + copy | in-process clone of shell state (copy-on-write variables) |\n| pipeline of builtins\u002Ffunctions | fork per stage | one thread per stage, OS pipes between them |\n| `.\u002Fscript.sh`, `#!\u002Fbin\u002Fbash` scripts | fork + exec bash | runs in a fresh in-process child shell |\n| external program | fork + exec | single `CreateProcess` |\n| startup | `\u002Fetc\u002Fprofile` runs `cygpath`, `locale`, `uname`… | environment set up natively (~9 ms) |\n| git prompt | `__git_ps1` spawns `git` several times per prompt | native `__git_ps1` reads `.git\u002FHEAD` |\n\nMeasured on the development machine (Git Bash 5.3, Windows 11, Defender on):\n\n| Benchmark | Git Bash | gash | Speedup |\n|---|---:|---:|---:|\n| startup `-c true` | 251 ms | 9 ms | 28× |\n| 100× `$(echo)` | 14,704 ms | 37 ms | ~400× |\n| 10× `( )` subshell | 1,787 ms | 14 ms | ~130× |\n| 10× `echo hi \\| cat` | 3,255 ms | 325 ms | 10× |\n| 20× external `\u002Fusr\u002Fbin\u002Ftrue` | 3,362 ms | 495 ms | 7× |\n| realistic script (read loop over 5k lines, recursive `fib`, assoc arrays) | 290,087 ms | 260 ms | ~1100× |\n\n## Compatibility\n\nThe `tests\u002Fscripts` corpus (61 scripts, ~2,000 labelled cases, expected output generated\nby real Git Bash) passes 100%. Supported:\n\n- Full grammar: pipelines, `&&`\u002F`||`, `&`, subshells, groups, `if`\u002F`case` (incl. `;&` `;;&`),\n  `while`\u002F`until`\u002F`for`\u002FC-style `for`\u002F`select`, functions, `[[ ]]`, `(( ))`, `time`, `!`,\n  here-docs (`\u003C\u003C`, `\u003C\u003C-`, quoted delimiters), here-strings, process substitution, aliases.\n- All parameter expansions: defaults\u002Falternates, `#`\u002F`%` trimming, `\u002F` `\u002F\u002F` `\u002F#` `\u002F%`\n  substitution (with `patsub_replacement` `&`), substrings, case modification, `${!ref}`,\n  `${!prefix*}`, `${!arr[@]}`, `@Q @E @P @A @a @U @u @L @K`, namerefs.\n- Indexed and associative arrays, `declare`\u002F`local`\u002F`readonly`\u002F`export` with all attributes,\n  integer\u002Fupper\u002Flower variables.\n- Arithmetic with all bash operators, bases (`0x`, `0`, `N#`), assignment operators.\n- Globbing with `nullglob`, `failglob`, `dotglob`, `nocaseglob`, `globstar`, `extglob`,\n  `GLOBIGNORE`; brace expansion including sequences.\n- `set -euxo pipefail`, `set -C`, `shopt` (all bash option names), traps (`EXIT`, `ERR`,\n  `RETURN`, `INT`, signals to self), `getopts`, `read` (all flags), `mapfile`, `printf`\n  (incl. `%q %b %(fmt)T`, `-v`), `echo`, `test`, `type`, `command`, `hash`, `eval`,\n  `source`, `exec` (incl. fd redirection), `pushd`\u002F`popd`\u002F`dirs`, `jobs`\u002F`wait`\u002F`kill`\u002F`fg`,\n  `alias`, `history`, `compgen`, ...\n- Bash's error-recovery rules (arithmetic and substitution errors discard the current\n  command line; `${x:?}` and `set -u` exit the script).\n\n### Windows\u002FMSYS integration\n\n- Paths: `\u002Fc\u002Ffoo` ↔ `C:\\foo`, `\u002Ftmp` → `%TMP%` (see below), `\u002Fusr\u002Fbin`, `\u002Fbin`, `\u002Fucrt64` →\n  Git's install dir, `\u002Fdev\u002Fnull`, `\u002Fdev\u002Fstdin|stdout|stderr|fd\u002FN`, `\u002Fdev\u002Ftty`. Windows paths\n  (`C:\\x`, `C:\u002Fx`) work everywhere too. `$PWD` and `pwd` show the MSYS form, `pwd -W` the\n  Windows one (`C:\u002F...`).\n- `\u002Ftmp` is the folder the MSYS runtime mounts there, which Windows' GetTempPathW gives at\n  startup: `TMP`, else `TEMP`, else your profile folder (`%USERPROFILE%`), else the Windows\n  folder. A value in MSYS form such as `TMP=\u002Ftmp` therefore means `\\tmp` on the current drive,\n  as it does for Git Bash. gash creates that folder if it doesn't exist, and only if it can't\n  uses `%LOCALAPPDATA%\\Temp` instead. Programs gash starts get `TMP` and `TEMP` set to the same\n  folder. MSYS programs still see another `\u002Ftmp` if an MSYS process from the same Git install\n  was already running with different `TMP`\u002F`TEMP` values: they share one mount table, and the\n  first process to start sets `\u002Ftmp` for all of them.\n- PATH is kept in MSYS form inside the shell and converted when launching programs.\n- Arguments to native programs get MSYS2-style path conversion (`\u002Fc\u002Fx` → `C:\u002Fx`),\n  honoring `MSYS_NO_PATHCONV` and `MSYS2_ARG_CONV_EXCL` when they are exported or given as\n  a command prefix (`MSYS_NO_PATHCONV=1 cmd ...`), as in Git Bash.\n- Arguments to MSYS programs are quoted so the MSYS runtime doesn't glob\u002Fbrace\u002Ftilde-expand\n  or `@file`-expand them.\n- Executables are found with or without `.exe`\u002F`.com`\u002F`.bat`\u002F`.cmd`; extensionless files with a\n  `#!` line are run via their interpreter (`#!\u002Fusr\u002Fbin\u002Fenv node`, `#!\u002Fusr\u002Fbin\u002Fpython3`, ...).\n- `$(...)` strips trailing `\\r\\n` like MSYS2 bash, so output of Windows programs is clean.\n  Scripts with CRLF line endings run (Git Bash would fail with `$'\\r': command not found`).\n- Interactive mode: Git Bash's default prompt (with a native `__git_ps1`), the `ls`\u002F`ll`\n  aliases from Git for Windows, emacs-style line editing, history (`~\u002F.bash_history`,\n  `HISTCONTROL`, `!!`, `!$`, `^old^new`, Ctrl+R), Tab completion of commands, files,\n  `$variables`, `~` and `\u002Fc\u002F...` paths, job notifications.\n\n## Microsoft Coreutils (optional)\n\nIf [Microsoft's Coreutils for Windows](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fcoreutils) (native uutils\nbuilds of coreutils, findutils and grep) is available, gash uses it in place of Git's MSYS\nversions of the same tools. Native tools start faster and avoid the MSYS runtime; on a script\nthat calls `grep`\u002F`head`\u002F`tail`\u002F`wc`\u002F`cut`\u002F`uniq` in a loop this measured about 15–25% faster\nend to end.\n\ngash looks for `coreutils.exe` in this order:\n\n1. `GASH_COREUTILS`: a path to `coreutils.exe` or its folder (`GASH_COREUTILS=0` turns this off)\n2. `coreutils\\coreutils.exe` next to `gash.exe` (a portable copy: unzip a release there)\n3. `%ProgramFiles%\\coreutils\\coreutils.exe` (installed with `winget install Microsoft.Coreutils`)\n\nHow it behaves:\n\n- Only commands that PATH lookup would resolve to Git's `\u002Fusr\u002Fbin` are swapped, so anything you\n  put earlier on PATH, or call by full path (`\u002Fusr\u002Fbin\u002Fcat`), still wins.\n- gash creates per-command hard links next to `coreutils.exe` (`bin\\cat.exe`, ...) on first\n  use, so `command -v cat` prints a path that really runs `cat`.\n- MSYS paths in arguments are translated for the native tools even when `MSYS_NO_PATHCONV` is\n  set (the caller asked for an MSYS tool), with a per-command policy: file operands are\n  converted, while `tr` sets, `basename`\u002F`dirname`\u002F`expr` strings and `grep` patterns are\n  never touched (`echo \"$PATH\" | grep \u002Fusr\u002Fbin` still works).\n- Arguments with wildcards are quoted so the native tools don't glob them a second time.\n- Kept on Git's GNU versions: `sort` and `find` (they can switch to the DOS commands' behaviour),\n  `mktemp`, `realpath`, `readlink` (they print Windows paths), `ln` (native symlinks need\n  Developer Mode), `env` and `xargs` (they can't start shell scripts). gash builtins such as\n  `echo`, `printf`, `test` and `pwd` are unaffected.\n\nLimitations: native tools can't create or open file names containing `* ? : \" \u003C > |`, which the\nMSYS runtime supports by remapping them (native `touch` also stops at the first such error), and\ntools that echo absolute paths they were given print them as `C:\u002F...` rather than `\u002Fc\u002F...`.\n\n## Installing\n\n```bash\nwinget install hex2f.gash\n```\n\nThis also installs Git for Windows if winget doesn't find it. Or download\n`gash-\u003Cversion>-x64.zip` (or `-arm64.zip`) from\n[Releases](https:\u002F\u002Fgithub.com\u002Fhex2f\u002Fgash\u002Freleases) and unzip it anywhere. `gash.exe` is a single\nfile with no runtime dependencies besides Git for Windows' tools.\n\n### macOS and Linux\n\nYou already have it installed. It's called `bash`.\n\n## Building\n\n```bash\ncargo build --release\n```\n\nThe binary is `target\\release\\gash.exe` (no runtime dependencies besides Git for Windows'\ntools, which it finds automatically; override with `GASH_ROOT=C:\\path\\to\\Git`). The C runtime\nis linked statically (`.cargo\u002Fconfig.toml`), so it doesn't need the Visual C++ Redistributable.\nReleases are built by `.github\u002Fworkflows\u002Frelease.yml` when a `v*` tag is pushed; see\n[packaging\u002Fwinget\u002FREADME.md](packaging\u002Fwinget\u002FREADME.md).\n\n## Using it\n\n```bash\ngash                      # interactive shell\ngash script.sh args       # run a script\ngash -c 'echo hi'         # run a command string\ngash -lc '...'            # login shell (sources ~\u002F.bash_profile)\n```\n\nTo use it **as** `bash`, copy (don't symlink) `gash.exe` to `bash.exe` (and `sh.exe`) in a\ndirectory of your choice; it reports itself as `bash` in error messages when invoked that way.\n\n- **Windows Terminal**: add a profile whose command line is\n  `C:\\path\\to\\gash.exe -l` (or the copied `bash.exe -l`).\n- **Claude Code** (or anything else that looks for Git Bash): set\n  `CLAUDE_CODE_GIT_BASH_PATH=C:\\path\\to\\bash.exe` pointing at the copy.\n- **VS Code**: add a terminal profile with `\"path\": \"C:\\\\path\\\\to\\\\gash.exe\", \"args\": [\"-l\"]`.\n\nStartup files: login shells read the first of `~\u002F.bash_profile`, `~\u002F.bash_login`,\n`~\u002F.profile`; interactive non-login shells read `~\u002F.bashrc` (or `--rcfile`). Git's\n`\u002Fetc\u002Fprofile` is **not** sourced (its environment is set up natively, which is a large part\nof the startup speedup); set `GASH_ETC_PROFILE=1` to source it anyway.\n\nFlags: `-c`, `-s`, `-i`, `-l`\u002F`--login`, `--norc`, `--noprofile`, `--rcfile FILE`,\n`--posix`, `-o opt`, `-O shopt`, any `set` flag (`-e -u -x ...`), `--version`.\n\n## Differences from Git Bash\n\n- **No `fork()`**: subshells, `$(...)` and pipeline stages run in-process (threads with\n  their own variables, cwd and fd table). Observable differences are rare: `$BASHPID` in a\n  subshell is a synthetic number, and `kill` of a subshell's `$BASHPID` only works for\n  signals delivered to itself.\n- **Process substitution** `\u003C(cmd)` \u002F `>(cmd)` uses temporary files rather than pipes, so\n  `\u003C(cmd)` runs `cmd` to completion first (not streaming).\n- **Job control**: no Ctrl+Z\u002Fstop (Windows has no SIGTSTP). Background jobs, `jobs`, `wait`,\n  `fg` (waits), `kill` work.\n- **Signals**: Windows only has Ctrl+C\u002FCtrl+Break. `kill -SIG pid` terminates external\n  processes; signals to the shell itself (`kill -USR1 $$`) run the matching trap.\n- **File descriptors > 2** work inside the shell (`exec 3>file`, `>&3`) but are not passed to\n  external programs (Windows can only pass stdin\u002Fstdout\u002Fstderr).\n- Strings are UTF-8 internally: `$'\\xff'`-style bytes ≥ 0x80 in variables are approximated;\n  `printf`\u002F`echo -e` write raw bytes correctly.\n- `\u002Fetc\u002Fprofile` and `\u002Fetc\u002Fbash.bashrc` aren't sourced by default (see above).\n\n## Testing\n\n```bash\ncargo test                          # unit tests + differential compat suite\nGASH_COMPAT_FILTER=015 cargo test --test compat   # one script\nGASH_COMPAT_JOBS=8 cargo test --test compat       # parallel\n```\n\n`tests\u002Fregen_expected.ps1` regenerates the expected outputs from Git Bash.\n\n## Contributing\n\n**Every commit must be attributed to the model that produced it, if any.** End the commit\nmessage with a trailer for each model used, naming the model and its version:\n\n```\nAssisted-By: GPT-5.1\nCo-Authored-By: Claude Opus 5.5 \u003Cnoreply@anthropic.com>\n```\n\n`Assisted-By: \u003Cmodel and version>` works for any model. `Co-Authored-By: \u003Cmodel and version> \u003Cnoreply@vendor>`\nis the form some tools, such as Claude Code, write themselves. If no model was involved, end the\nmessage with `Assisted-By: none`. A PR check fails on any commit without one of these and comments\non the PR with what to fix; reword the commits with `git rebase -i` and force-push.\n\n## Layout\n\n| File | Purpose |\n|---|---|\n| `src\u002Fparser.rs` | Recursive-descent parser (heredocs, aliases, `[[ ]]`, arithmetic, all word forms) |\n| `src\u002Fexpand.rs` | Brace\u002Ftilde\u002Fparameter\u002Fcommand\u002Farithmetic expansion, IFS splitting, globbing |\n| `src\u002Fexec.rs` | Pipelines, subshells, functions, redirections, process launching, script execution |\n| `src\u002Fbuiltins.rs`, `src\u002Fbuiltins_io.rs` | Builtins |\n| `src\u002Fshell.rs`, `src\u002Fvars.rs` | Shell state, copy-on-write variable scopes, options, jobs |\n| `src\u002Fio.rs` | Per-shell fd table over files, pipes, memory buffers and the console |\n| `src\u002Fpath.rs` | MSYS mount table emulation and path\u002Fargument conversion |\n| `src\u002Fpattern.rs`, `src\u002Fregex.rs` | Glob\u002Fextglob matcher, POSIX ERE engine for `=~` |\n| `src\u002Farith.rs` | Arithmetic evaluator |\n| `src\u002Flineedit.rs`, `src\u002Finteractive.rs`, `src\u002Fprompt.rs` | Line editor, REPL, completion, prompts |\n| `src\u002Fsys.rs` | Win32 FFI (no `windows-sys` dependency) |\n| `assets\u002Fgash-icon.svg` | The gash icon |\n| `assets\u002Fmake_icon.py`, `build.rs` | Rasterize the icon into `assets\u002Fgash.ico`; embed it in `gash.exe` (writes the `.res` directly, no resource compiler) |\n| `assets\u002Fmake_speed_svg.py` | Builds the speed animation at the top of this README from the measured timings |\n| `.github\u002Fworkflows\u002Frelease.yml` | Builds x64\u002Farm64 zips on a `v*` tag, publishes the GitHub release, submits to winget |\n| `.github\u002Fworkflows\u002Fattribution*.yml`, `.github\u002Fscripts\u002Fcheck-attribution.sh` | Checks that every PR commit names the models that produced it, and comments on the PR when one doesn't |\n| `packaging\u002Fwinget\u002F` | winget manifests for the first submission, and how releases reach winget |\n| `assets\u002Fvideo\u002F` | Renders that animation frame by frame into an MP4 (`python assets\u002Fvideo\u002Fserver.py`, then open `http:\u002F\u002Flocalhost:8765\u002Fvideo\u002Frender.html` and run `renderVideo('dark')`) |\n\nThe speed animation's style is inspired by Ben Dicken's \"language balls\". Git logo by\n[Jason Long](https:\u002F\u002Fgit-scm.com\u002Fdownloads\u002Flogos), licensed under CC BY 3.0.\n","gash 是一个为 Windows 设计的快速、原生、bash 兼容的命令行 shell，旨在作为 Git Bash 的零依赖、从头编写的替代品。它完全兼容 bash 语法与语义（包括子shell、管道、参数扩展、数组、算术表达式等），通过避免 MSYS2\u002FCygwin 的 fork() 模拟机制，改用进程内状态克隆与原生 Windows 进程创建（CreateProcess），显著提升启动速度与脚本执行性能。适用于需要高频使用 bash 脚本、Git 工作流、CI\u002FCD 本地调试或对终端响应延迟敏感的 Windows 开发者场景。","2026-11-24 04:37:17","CREATED_QUERY"]