{"id":17383302,"url":"https://github.com/gianluca-mascolo/bash-profile-switcher","last_synced_at":"2025-04-15T09:40:35.170Z","repository":{"id":39878318,"uuid":"489609792","full_name":"gianluca-mascolo/bash-profile-switcher","owner":"gianluca-mascolo","description":"Easily change environment variables and settings using bash","archived":false,"fork":false,"pushed_at":"2025-01-27T16:17:02.000Z","size":174,"stargazers_count":16,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T18:52:00.517Z","etag":null,"topics":["bash","bash-hacks","bash-profile","bash-script","bashrc","bashrc-configs","environment-configuration","environment-variables","environment-vars","shell","shell-scripting","shell-scripts","shellscript"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gianluca-mascolo.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":"2022-05-07T08:01:58.000Z","updated_at":"2025-02-04T12:07:57.000Z","dependencies_parsed_at":"2023-10-15T17:03:54.521Z","dependency_job_id":"18178450-6a19-4056-bd40-459ce83b0899","html_url":"https://github.com/gianluca-mascolo/bash-profile-switcher","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gianluca-mascolo%2Fbash-profile-switcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gianluca-mascolo%2Fbash-profile-switcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gianluca-mascolo%2Fbash-profile-switcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gianluca-mascolo%2Fbash-profile-switcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gianluca-mascolo","download_url":"https://codeload.github.com/gianluca-mascolo/bash-profile-switcher/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249045372,"owners_count":21203865,"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-hacks","bash-profile","bash-script","bashrc","bashrc-configs","environment-configuration","environment-variables","environment-vars","shell","shell-scripting","shell-scripts","shellscript"],"created_at":"2024-10-16T07:41:13.135Z","updated_at":"2025-04-15T09:40:35.128Z","avatar_url":"https://github.com/gianluca-mascolo.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bash-profile-switcher ![CI](https://github.com/gianluca-mascolo/bash-profile-switcher/actions/workflows/ci.yml/badge.svg)\nEasily change environment variables and settings using bash\n\n## About\n\nThis script aim to manage multiple profile files for bash. It's like having multiple `.bashrc` files to load or unload when needed.\nYou need to create your custom profile files under `~/.bash_profile.d` directory. Each profile must have extension `.profile` and it is a plain text file containing a list of \"snippets\" (one per line) to be loaded into your profile.\nSnippets are `.sh` files where you can set variables/aliases/functions or any command you want to execute when you spawn a shell ([snippet example](examples/snippet-example.sh)).\n\n## Installation\n\nUse `make install`. It will install `bash_profile_switcher.sh` in `~/.bash_profile_switcher` and source it in your `~/.bashrc`. Reload your shell or open a new terminal to use it.\u003cbr\u003e\n_Note_: You can use `make install INSTALL_PATH=\u003cpath\u003e` to install the script in a custom path.\n\n## Usage\n\nUse `switch_profile` function to change profile\n\n```\n ~]$ switch_profile -h\nswitch_profile [options] profile\n\nOPTIONS\n  -k\n    Keep env. Load selected profile without unloading current environment.\n  -d\n    Don't load profile. Unload current profile and don't load any profile in new bash shells\n  -t\n    Temporary profile. Load selected profile in current shell without starting it in new bash shells\n  -l\n    List available profiles\n  -h Show help instructions (this help)\n```\n\n## Example\n\nAs an example take the following directory structure for `~/.bash_profile.d`\n```\n.bash_profile.d/\n├── foo.profile\n├── bar.profile\n└── snippets\n    ├── tools.sh\n    ├── cloudvars.sh\n    └── setpath.sh\n```\n\n```\n]$ cat ~/.bash_profile.d/foo.profile\ntools\ncloudvars\nsetpath\n]$ cat ~/.bash_profile.d/bar.profile\nsetpath\n```\n\nWhen you do `switch_profile foo` snippets `tools.sh`,`cloudvars.sh`,`setpath.sh` will be loaded (in the same order they are listed in profile).\nOn profile change `switch_profile bar` bash will first unload all the snippets applied by `foo` in reverse order then load the snippets listed in `bar`, that is `setpath.sh`\n``\n## Issues\n\n* Spaces and blank characters are not supported on profile filenames\n* Be careful when managing special variables like `PATH`\n\n## Test automation\n\nBash command interaction is tested with `expect`. It requires the following packages to be installed:\n\n* `expect`\n* `docker`\n* `docker-compose`\n* `make`\n\nTo run tests locally use:\n```\nmake clean \u0026\u0026 make test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgianluca-mascolo%2Fbash-profile-switcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgianluca-mascolo%2Fbash-profile-switcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgianluca-mascolo%2Fbash-profile-switcher/lists"}