{"id":19136858,"url":"https://github.com/mdub/withenv","last_synced_at":"2026-06-08T21:30:13.528Z","repository":{"id":7608753,"uuid":"8966801","full_name":"mdub/withenv","owner":"mdub","description":"Execute Shell commands in a specified environment","archived":false,"fork":false,"pushed_at":"2015-11-30T03:24:44.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-03T13:17:06.208Z","etag":null,"topics":[],"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/mdub.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}},"created_at":"2013-03-23T06:41:29.000Z","updated_at":"2015-11-30T03:24:44.000Z","dependencies_parsed_at":"2022-07-21T14:19:47.403Z","dependency_job_id":null,"html_url":"https://github.com/mdub/withenv","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/mdub%2Fwithenv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdub%2Fwithenv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdub%2Fwithenv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdub%2Fwithenv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdub","download_url":"https://codeload.github.com/mdub/withenv/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240215436,"owners_count":19766416,"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":[],"created_at":"2024-11-09T06:35:43.104Z","updated_at":"2026-06-08T21:30:13.419Z","avatar_url":"https://github.com/mdub.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# withenv\n\n\"withenv\" runs a shell command in the context of a named environment. \n\nFor example:\n\n    $ withenv my-aws-credentials -- aws s3 list-buckets\n\nHere, \"`my-aws-credentials`\" is the name of the environment, and \"`aws s3 list-buckets`\" is the command to run.\n\n## Installing it\n\n\"withenv\" is implemented using bash shell functions.  Install it with:\n\n    source path/to/withenv/withenv.bash\n\n## Defining environments\n\nIn this context, an \"environment\" means a set of environment variables.  You define environments by creating shell-script fragments which set environment variables, e.g.\n\n    # /Users/mdub/.withenv/my-aws-credentials\n    export AWS_ACCESS_KEY_ID=AKIBIJQ4XSWNFIF426NQ\n    export AWS_SECRET_ACCESS_KEY=abNFIEVdwcQdeadbeefnnShq4B1pG7qZ9sqNwoFO\n\nThey're just shell scripts; `withenv` will \"`source`\" them as required.\n\n## Using it\n\nYou can specify a full path to the environment file:\n\n    $ withenv /etc/aws-credentials.sh -- aws ec2 list-instances\n\nOr, you can just supply a short-name (as in the first example), in which case we'll look for the file in `$WITHENV_DIR` (which defaults to `$HOME/.withenv`).\n\nIf multiple environments are specifed, `withenv` will load them all:\n\n    $ withenv my-aws-credentials ruby-gc -- funky-aws-stuff.rb\n\n## Bash completion\n\n`withenv` comes complete with Bash programmable completion support, for no extra cost.  For example:\n\n    $ withenv my-aw[TAB]\n    $ withenv my-aws-credentials\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdub%2Fwithenv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdub%2Fwithenv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdub%2Fwithenv/lists"}