## [[BusyBox]]
まずはベースコマンドを[[BusyBox]]でインストールする。[[Scoop]]でインストールした。
```bash
scoop install busybox
```
自動でコマンドにリンクが貼られるので、[[PowerShell]]に登録されていないAliasは[[Linux]]と同じように使える。
## [[uutils coreutils]]
[[BusyBox]]は日本語の取り扱いが十分ではない。たとえば、[[PowerShell]]で[[cat]]した文字列に対し、[[grep]]で日本語を指定してもヒットしない。
[[uutils coreutils]]を使うとそのあたりをフォローできる。
### [[uutils coreutils]]を使った設定
[[uutils coreutils]]のコマンドを優先して使うには[[PowerShell]]のプロファイルに設定が必要。
[[MacOS ユーザが WSL では無い Windows のコンソール環境を整える]]の中で紹介されている方法を使わせてもらった。
```powershell
# 上記記事の内容をそのまま引用
@"
arch, base32, base64, basename, cat, cksum, comm, cp, cut, date, df, dircolors, dirname,
echo, env, expand, expr, factor, false, fmt, fold, hashsum, head, hostname, join, link, ln,
ls, md5sum, mkdir, mktemp, more, mv, nl, nproc, od, paste, printenv, printf, ptx, pwd,
readlink, realpath, relpath, rm, rmdir, seq, sha1sum, sha224sum, sha256sum, sha3-224sum,
sha3-256sum, sha3-384sum, sha3-512sum, sha384sum, sha3sum, sha512sum, shake128sum,
shake256sum, shred, shuf, sleep, sort, split, sum, sync, tac, tail, tee, test, touch, tr,
true, truncate, tsort, unexpand, uniq, wc, whoami, yes
"@ -split ',' |
ForEach-Object { $_.trim() } |
Where-Object { ! @('tee', 'sort', 'sleep').Contains($_) } |
ForEach-Object {
$cmd = $_
if (Test-Path Alias:$cmd) { Remove-Item -Path Alias:$cmd }
$fn = '$input | uutils ' + $cmd + ' $args'
Invoke-Expression "function global:$cmd { $fn }"
}
```