0

Is there a bash shell script or command that I can invoke to restore the original value to $PS1? I clobbered it without making a backup copy. If need be, I can always re-install bash, I'm hoping there is a less drastic method.

BTW, I'm using bash v5.2.26

2
  • How did you change it? Editing .bashrc or by directly setting PS1=...? Feb 16 at 0:34
  • 1
    the builtin default is \s-\v\$ , which gives something like bash-5.2.26$ . Other than that, it's set in the shell's startup files, of which there are many, both in /etc and in the user's home directory. So the question really is, what exactly did you do to clobber it?
    – ilkkachu
    Feb 16 at 10:54

1 Answer 1

1

Depending on exactly how you destroyed your setting for PS1, you might find additional settings in the contents of /etc/profile or /etc/skel/.profile for instance. "I clobbered it" doesn't exactly lend much specificity with respect to what you actually did. If all you did was something akin to unset PS1, then sourceing your .profile or .bashrc file would probably restore your prompt.

2
  • Thanks for the help. In an effort to keep it simple, I left out key details. My problem was entangled with the use of bash_completion; it turns out it is invoked twice upon my termux system startup, before the first prompt is displayed. Once I unwound and disabled bash_completion, and restarted the system, the original prompt was restored. BTW, somewhere in termux startup, $PS1 is set to \[\e[0;32m\]\w\[\e[0m\] \[\e[0;97m\]\$\[\e[0m\], which I don't understand. Thanks again.
    – John-L_.
    Feb 16 at 23:44
  • 1
    Happy to have helped. The stuff you may not understand in that prompt are ANSI color codes that tell the terminal to color various prompt components. \e is an Escape character which is part of that control sequence. <ESC>[0;32m is the ANSI sequence for "reset the color and then set the text to green" for example.
    – DopeGhoti
    Feb 16 at 23:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .