Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

Maws prompt not displaying properly when it ends in \$ #204

Open
limed opened this issue Mar 20, 2020 · 1 comment
Open

Maws prompt not displaying properly when it ends in \$ #204

limed opened this issue Mar 20, 2020 · 1 comment

Comments

@limed
Copy link

limed commented Mar 20, 2020

When running the eval $(maws) command my bash prompt is not updating correctly with the correct $(maws_profile) name. This is how my prompt looks like when I run the command (arn edited with bogus account id)

limed@kaylee:~$ eval $(maws)
Environment variables set for role arn:aws:iam::12345678:role/maws-admin
limed@kaylee:~$(maws_profile)$

The maws_profile function does appear to be populated

limed@kaylee:~$(maws_profile)$ echo $(maws_profile)
(itsre-apps-maws-admin)

And this is my PS1 variable

$ echo $PS1
${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]$(__git_ps1 "(%s)"):\[\033[01;34m\]\w\[\033[00m\]\$(maws_profile)$

The shell I am using is bash and I'm using bash version 5

$ echo $SHELL
/bin/bash
limed@kaylee:~$(maws_profile)$ bash --version
GNU bash, version 5.0.16(1)-release (x86_64-apple-darwin19.3.0)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
@smarnach
Copy link

This happens if your PS1 ends in \$ rather than just $ . Maws only strips off $ , leaving the back slash in place, so the $(maws_profile) gets escaped and never executed. The workaround is to modify your bashrc file and set your PS1 to a prompt ending in just $ without the back slash – there is no need to escape the trailing dollar sign.

@gene1wood gene1wood changed the title Maws prompt not displaying properly Maws prompt not displaying properly when it ends in \$ Apr 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants