{"id":19208647,"url":"https://github.com/heiwa4126/powershell-bg","last_synced_at":"2025-02-23T07:16:36.200Z","repository":{"id":111910362,"uuid":"399656637","full_name":"heiwa4126/powershell-bg","owner":"heiwa4126","description":"bashで `a; b \u0026 c \u0026 d ; e` みたいのをPowershellでやるサンプル。","archived":false,"fork":false,"pushed_at":"2021-08-25T02:43:24.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-04T16:19:05.902Z","etag":null,"topics":["example","powershell"],"latest_commit_sha":null,"homepage":"","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/heiwa4126.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-25T01:48:11.000Z","updated_at":"2021-08-25T02:43:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"e60c7c25-4ac2-4c96-a9fe-29deb55fbe22","html_url":"https://github.com/heiwa4126/powershell-bg","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heiwa4126%2Fpowershell-bg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heiwa4126%2Fpowershell-bg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heiwa4126%2Fpowershell-bg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heiwa4126%2Fpowershell-bg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heiwa4126","download_url":"https://codeload.github.com/heiwa4126/powershell-bg/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240280984,"owners_count":19776418,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["example","powershell"],"created_at":"2024-11-09T13:27:16.702Z","updated_at":"2025-02-23T07:16:36.168Z","avatar_url":"https://github.com/heiwa4126.png","language":"PowerShell","readme":"# powershell-bg\n\nbashで `a; b \u0026 c \u0026 d ; e` みたいのをPowershellでやるサンプル。\n\n動作確認は\n- Windows10上のPowershell 5,7\n- Linux上のPowershell 7\n\n`doit.sh` と `doit.ps1`を比較してみてください。\n\n# 実行\n\n## bash版\n\n```sh\n./init.sh ; ./doit.sh\n```\n\n## Powershell版\n\nWindows上でPowershell 6以上の場合\n```pwsh\npwsh .\\init.ps1\npwsh .\\doit.ps1\n```\n\n# 参考\n\n- [Powershell equivalent of bash ampersand (\u0026) for forking/running background processes - Stack Overflow](https://stackoverflow.com/questions/185575/powershell-equivalent-of-bash-ampersand-for-forking-running-background-proce)\n- [Start\\-Job \\(Microsoft\\.PowerShell\\.Core\\) \\- PowerShell \\| Microsoft Docs](https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Core/Start-Job?view=powershell-7.1)\n- [Remove\\-Job \\(Microsoft\\.PowerShell\\.Core\\) \\- PowerShell \\| Microsoft Docs](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/remove-job?view=powershell-7.1)\n- [Job Control \\(Bash Reference Manual\\)](https://www.gnu.org/software/bash/manual/html_node/Job-Control.html#Job-Control)\n\n# メモ\n\n以下の2つはおなじ。\n- `$job1 = Start-Job -ScriptBlock { Get-Content 3 }`\n- `$job1 = \u0026 { Get-Content 3 } \u0026`\n\n上の方がStart-Jobのオプションつけられる利点が。\n\nReceive-Jobで-Keepをつけなければ Remove-Job は不要。\n\nReceive-Jobで-Nameじゃなくて-Jobにすれば $job.Nameはいらない(しかもデフォルトオプション)。以下の3つは同じ。\n- `Receive-Job -Name $job1.Name`\n- `Receive-Job -Job $job1`\n- `Receive-Job $job1`\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheiwa4126%2Fpowershell-bg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheiwa4126%2Fpowershell-bg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheiwa4126%2Fpowershell-bg/lists"}