{"id":20565778,"url":"https://github.com/phenax/shell-macros","last_synced_at":"2026-04-11T09:02:20.318Z","repository":{"id":83227664,"uuid":"247128041","full_name":"phenax/shell-macros","owner":"phenax","description":"Write command line macros in bash and zsh","archived":false,"fork":false,"pushed_at":"2020-03-15T11:20:03.000Z","size":24,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-16T19:52:17.194Z","etag":null,"topics":["bash","dotfiles","macros","shell","zsh"],"latest_commit_sha":null,"homepage":null,"language":"Shell","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/phenax.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2020-03-13T17:35:39.000Z","updated_at":"2021-06-23T13:37:19.000Z","dependencies_parsed_at":"2023-06-29T00:30:38.815Z","dependency_job_id":null,"html_url":"https://github.com/phenax/shell-macros","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/phenax%2Fshell-macros","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phenax%2Fshell-macros/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phenax%2Fshell-macros/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phenax%2Fshell-macros/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phenax","download_url":"https://codeload.github.com/phenax/shell-macros/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242179252,"owners_count":20084940,"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","dotfiles","macros","shell","zsh"],"created_at":"2024-11-16T04:39:06.892Z","updated_at":"2025-12-31T00:56:32.091Z","avatar_url":"https://github.com/phenax.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Shell Macros\nWrite command line macros in bash and zsh\n\n## Prerequisites\nYou need the `git` and `curl` to use the macros install script\n```bash\nsudo apt install git curl\n```\n\n\n## Installation\nTo install `macros`, run this script\n```bash\ncurl https://raw.githubusercontent.com/phenax/shell-macros/master/install.sh | bash -\n```\n\n\n## Usage\nRun the help command to see the list of available commands\n```bash\nmacros help\n```\n\n#### Commands\n```\nCommands:\n  start \u003cmacro name\u003e    - Creates a new macro recording session\n  run \u003cmacro name\u003e      - Run a recorded macro\n  ls                    - List all available macros\n  delete \u003cmacro name\u003e   - Delete a macro\n  help                  - This dialog\n```\n\n#### Recording a macro\nTo generate a macro use the `macros start \u003cname\u003e` command\n```bash\nmacros start my_macro_to_do_stuff\n```\n\nThis will give you a new shell session to start executing your macro in.\nSo you can go ahead and run your set of commands.\n\nWhen you are done, just run `exit` or press `Ctrl+D` to save and exit out of the session.\n```bash\nexit\n```\n\n#### Executing a macro\nYou can run your macro using the `macros run \u003cname\u003e` command\n```bash\nmacros run my_macro_to_do_stuff\n```\n\n\n#### Adapter for bash\nAdd this to the bottom of your `~/.bashrc`\n```bash\nsource $HOME/.config/shell-macros/adapters/bash;\n```\n\n#### Adapter for zsh\nAdd this to the bottom of your `~/.zshrc`\n```bash\nsource $HOME/.config/shell-macros/adapters/zsh;\n```\n\n\n### Dynamic macros\nYou can also create dynamic macros using environment variables\n\n```bash\nBRANCH=my_branch macros start git_sync\n```\n\nContinue to use the branch name env variable in your macro session\n```bash\ngit checkout $BRANCH;\ngit pull;\ngit pull origin master;\ngit push -u origin $BRANCH;\nexit;\n```\n\nAnd then when you want to re-use the macro for a different branch, you can use pass the env variable to the `run` command as such\n\n```bash\nBRANCH=some_other_branch macros run git_sync\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphenax%2Fshell-macros","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphenax%2Fshell-macros","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphenax%2Fshell-macros/lists"}