{"id":13641166,"url":"https://github.com/nyabkun/bash-to-powershell-converter","last_synced_at":"2025-04-20T07:32:10.860Z","repository":{"id":46327990,"uuid":"341181116","full_name":"nyabkun/bash-to-powershell-converter","owner":"nyabkun","description":"Converts bash script to powershell script.","archived":false,"fork":false,"pushed_at":"2023-05-06T13:29:52.000Z","size":28,"stargazers_count":56,"open_issues_count":1,"forks_count":18,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-08-03T01:20:01.789Z","etag":null,"topics":["bash","bash-profile","bash-script","bashrc","nodejs","powershell","powershell-profile"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nyabkun.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}},"created_at":"2021-02-22T11:43:11.000Z","updated_at":"2024-08-03T01:20:01.790Z","dependencies_parsed_at":"2022-08-30T10:41:10.513Z","dependency_job_id":null,"html_url":"https://github.com/nyabkun/bash-to-powershell-converter","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/nyabkun%2Fbash-to-powershell-converter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nyabkun%2Fbash-to-powershell-converter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nyabkun%2Fbash-to-powershell-converter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nyabkun%2Fbash-to-powershell-converter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nyabkun","download_url":"https://codeload.github.com/nyabkun/bash-to-powershell-converter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223822072,"owners_count":17208799,"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":["bash","bash-profile","bash-script","bashrc","nodejs","powershell","powershell-profile"],"created_at":"2024-08-02T01:01:18.398Z","updated_at":"2024-11-09T11:30:48.301Z","avatar_url":"https://github.com/nyabkun.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Bash to Powershell Converter\n\nA [node.js](https://en.wikipedia.org/wiki/Node.js) script that converts [bash](https://en.wikipedia.org/wiki/Bash_(Unix_shell)) to [powershell](https://en.wikipedia.org/wiki/PowerShell).\n\nOnly simple things like imports and aliases are supported.\n\nIt is a simple script using regular expressions, so feel free to fork it and modify it as you wish.\n\n```powershell\nnode bash2pwsh.js ./You-can-test-with-this-bash-script/.bash_profile bash_profile.ps1\n```\n\n## .bash_profile [Before]\n```bash\n## Util\n\nfunction pipe() {\n  local outfile=~/pipe.md\n  $@ \u003e\u0026 $outfile\n  code $outfile\n}\n\n## App\n\nalias play_mpc_be='C:/App/MediaPlayerClassic-BE/mpc-be64.exe'\nalias code='C:/Dev/VSCode/Code.exe'\n\n## Dir\n\nexport d_diary='C:/Ws/diary'\nexport d_ws='C:/Ws'\nexport d_App='C:/App'\nexport d_AppInst='C:/AppInst'\nexport d_Dev='C:/Dev'\n\nalias cd_diary=\"cd $d_diary\"\nalias cd_ws=\"cd $d_ws\"\nalias cd_App=\"cd $d_App\"\nalias cd_AppInst=\"cd $d_AppInst\"\nalias cd_Dev=\"cd $d_Dev\"\n\n## Util Alias\n\nalias la='ls -a'\nalias ll='ls -al'\nalias exp_open_here='explorer .'\n\n## Git Alias\n\nalias git_hist='git log --oneline --graph --decorate --all'\nalias git_com='git commit --allow-empty-message --no-edit'\nalias git_conf_global='git config --global --edit'\nalias git_conf_local='git config --edit'\nfunction git_add_com_push() {\n　git add -A\n  git commit --allow-empty-message --no-edit\n  git push\n}\n\n## Edit\n\nfunction edit_alias(){\n  code ~/.alias.zsh\n}\nfunction edit_alias_sh_only(){\n  code ~/.alias-sh.zsh\n}\nfunction edit_zshrc() {\n  code ~/.zshrc\n}\nfunction edit_pwsh_profile(){\n  code C:/Users/owner/Documents/PowerShell/Microsoft.PowerShell_profile.ps1\n}\n\n## Env\nexport PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfg\nexport PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/share/pkgconfig\n```\n\n`\u003e\u003e\u003e`\n\n## bash_profile.ps1 [After]\n\n```powershell\n## Util\n\nfunction pipe() {\n  local outfile=C:/msys64/home/owner/pipe.md\n  $args | Out-File -FilePath $outfile\n  code $outfile\n}\n\n## App\n\nSet-Alias -Name play_mpc_be -Value 'C:/App/MediaPlayerClassic-BE/mpc-be64.exe'\nSet-Alias -Name code -Value 'C:/Dev/VSCode/Code.exe'\n\n## Dir\n\n$d_diary='C:/Ws/diary'\n$d_ws='C:/Ws'\n$d_App='C:/App'\n$d_AppInst='C:/AppInst'\n$d_Dev='C:/Dev'\n\nfunction cd_diary() { cd $d_diary }\nfunction cd_ws() { cd $d_ws }\nfunction cd_App() { cd $d_App }\nfunction cd_AppInst() { cd $d_AppInst }\nfunction cd_Dev() { cd $d_Dev }\n\n## Util Alias\n\nfunction la() { ls -a }\nfunction ll() { ls -al }\nfunction exp_open_here() { explorer . }\n\n## Git Alias\n\nfunction git_hist() { git log --oneline --graph --decorate --all }\nfunction git_com() { git commit --allow-empty-message --no-edit }\nfunction git_conf_global() { git config --global --edit }\nfunction git_conf_local() { git config --edit }\nfunction git_add_com_push() {\n  git add -A\n  git commit --allow-empty-message --no-edit\n  git push\n}\n\n## Edit\n\nfunction edit_alias(){\n  code C:/msys64/home/owner/.alias.zsh\n}\nfunction edit_alias_sh_only(){\n  code C:/msys64/home/owner/.alias-sh.zsh\n}\nfunction edit_zshrc() {\n  code C:/msys64/home/owner/.zshrc\n}\nfunction edit_pwsh_profile(){\n  code C:/Users/owner/Documents/PowerShell/Microsoft.PowerShell_profile.ps1\n}\n\n## Env\n$env:PKG_CONFIG_PATH += \";C:/msys64/usr/local/lib/pkgconfg\"\n$env:PKG_CONFIG_PATH += \";C:/msys64/usr/local/share/pkgconfig\"\necho \"Loaded : $PSCommandPath\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnyabkun%2Fbash-to-powershell-converter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnyabkun%2Fbash-to-powershell-converter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnyabkun%2Fbash-to-powershell-converter/lists"}