#5234 Improve scripts for setting PS1
Closed: Fixed None Opened 3 years ago by mizdebsk.

All hosts with base role recently started to display PROD/STG text in shell prompt by setting PS1.

Attached patch improves the way PS1 is set:

  1. Generic \$ is used, which displays $ for non-root users and # for root

  2. path is separated from host name with space, just like in default Fedora prompt

  3. problems with line editing are fixed by using [ and ]

  4. for portability tput is used instead of hardcoding ANSI escape codes


I went ahead and applied this. :)

Sadly, this isn't ideal either...

kevin@sheelba ~ % ssh batcave01
tmtput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
Last login: Wed Apr 13 23:05:57 2016 from bastion01.phx2.fedoraproject.org

And bunches of cron jobs are sending:

tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified

So, I think we need to drop the tput here?

bummer - but yeah the tput sets the color. I can expirement with tput today to see if there is a better way.

Only setting PS1 for interactive shells might be all that's needed here (e.g. [[ $- =~ i ]] && PS1=...).

I'll attach a patch if anyone wants to test it. I ran into this while doing a git fetch from pkgs.fpo.

I went ahead and applied this.

The thing I was seeing eariler was due to my proxying via bastion... so it was there that was showing the tputs. ;)

Any other improvements we could make here?

ok. I guess for now, lets close this and if we see something else we want to change go with a new ticket.

Login to comment on this ticket.

Metadata