gimme-aws-creds: $(gimme-aws-creds) doesn't work on zsh

When running $(gimme-aws-creds) on zsh, I get the following error: zsh: command not found: #.

Expected Behavior

I expect this command to also work on zsh.

Current Behavior

The above described error occurs and the env variables are not set.

Possible Solution

Remove the comment from the output or make it dependent on the shell being used (i.e. $SHELL).

Steps to Reproduce (for bugs)

  1. Use zsh as the shell
  2. Run $(gimme-aws-creds)

Context

I had to run gimme-aws-creds and then copy the output and run it manually.

Your Environment

  • App Version used: gimme-aws-creds 2.1.3
  • Environment name and version: zsh 5.7.1
  • Operating System and version: macOS 10.15.1

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 6
  • Comments: 24 (1 by maintainers)

Most upvoted comments

you could try cd ~ find -name gimme-aws-creds teoretically it should be ./.local/bin/gimme-aws-creds

also you can add export PATH=~/.local/bin:$PATH in ~/.zshrc file and restart terminal

BTW a simple workaroud until the PR is rolled in: $(gimme-aws-creds | grep '^EXPORT')

This removes all but the lines that start from the EXPORT before passing to bash for execution.

https://github.com/Nike-Inc/gimme-aws-creds/blob/master/gimme_aws_creds/main.py#L181

In the above line a string output to the stdout is the cause of the issue. Typically there are two lines logged to the stdout prior to the export statements are the cause of this issue, I think.

Saving arn:aws:iam::<account-id>:role/<role-name> as <role-name>
Written profile <role-name> to /Users/<username>/.aws/credentials