Maws prompt not displaying properly when it ends in \$
limed opened this issue · 1 comments
limed commented
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 commented
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.