Questions tagged [ps1]

DO NOT USE this tag for questions about PowerShell scripts, use [powershell] instead. Questions about the BASH shell's PS1 (Prompt String 1) input prompt facility.

DO NOT USE this tag for questions about PowerShell scripts, use [powershell] instead.

Questions about the BASH shell's PS1 (Prompt String 1) input prompt facility.

222 questions
0
votes
0 answers

My terminal's PS1 is 2 lines, when I clear the screen, the first line gets cleared as well, how can I prevent this?

Using zsh / oh-my-zsh / amit theme. Mac / iTerm. $PS1 is $(_user_host)${_current_dir} $(git_prompt_info) $(_ruby_version) %{$fg[$CARETCOLOR]%}▶%{$resetcolor%} When I clear my screen (with cmd+k), it clears the first line, leaving just the ▶ as my…
Mike Manfrin
  • 2,722
  • 2
  • 26
  • 41
0
votes
1 answer

Bash prompt buggy when going through history

I have customised my PS1 bash variable, but when I go through the history it starts getting bugged and doing weird stuff. I've gone several times over it but can't seem to find anything wrong. \[\e]0;\u@\h:…
Ypsilon
  • 122
  • 1
  • 9
0
votes
1 answer

Why does adding \n at the end of my PS1 lead to substitution errors?

So, I'm on Windows and play around with my PS1 for the Git bash. My PS1 looks like this: PS1="\n\[\033[01;35m\]\u@\h\[\033[01;34m\] $PWD \[\033[00m\]\[\033[01;32m\]$(__git_ps1 "(%s)")\[\033[00m\]\nλ " Then I noticed that the branch name isn't…
eckes
  • 64,417
  • 29
  • 168
  • 201
0
votes
1 answer

How to improve generation speed of PS1 in this code?

PROMPT_COMAND runs slow. Code optimization needed. I use bash builtin PROMPT_COMMAND to customize PS1. Too much echo | grep commands were executed to get colorful git branch indication.The prompt runs much slower. Any ideas about…
0
votes
1 answer

PS1 does not echo backslash

I want this Bash prompt: /\ /\ root@debian$: I do: PS1="/\ /\\n${debian_chroot:+($debian_chroot)}\u@\h\$:" Or: PS1="/\ /\\\n${debian_chroot:+($debian_chroot)}\u@\h\$:" But I have: /\ / root@debian$:
achille
  • 173
  • 1
  • 3
  • 12
0
votes
0 answers

Deleting Terminal Input Doesn't Disappear (BashRC?)

I have modified my MacOS terminal by introducing a .bash_profile and .bashRC. When typing commands into the terminal and it goes to a new line, if I then backspace/delete the input I entered it will delete all content but the first line will leave…
0
votes
0 answers

How do I embed both a command and new line into my custom bash prompt?

I am working in git-bash on windows and I am trying to configure my bash prompt so that it displays like: username: $ To generate my custom abbreviated form of pwd I was going to substitute my own custom script…
0
votes
0 answers

How can I colorize the prompt string of Windows command line, as I do to PS1 of Linux?

EDIT: This question already has an answer here: https://superuser.com/questions/427820/how-to-change-only-the-prompt-color-of-the-windows-command-line/804458#804458 Please mark it as duplicate, thanks. I know how to decorate $PS1 in Linux, but I…
WesternGun
  • 11,303
  • 6
  • 88
  • 157
0
votes
0 answers

regex get PS1 prompt value spaning 2 lines in .bash_profile using ruby

I want to get the value and line number from the .bash_profile so that I can either delete it or update it if it doesn't match. Current example from the file is. if [ -f ~/.bashrc ]; then . ~/.bashrc fi export PS1="`whoami`@\h:\${PWD} \t #…
debow
  • 73
  • 7
0
votes
1 answer

PS1 prompt differences between bash versions 3.2.25 v 4.1.2

I have a preferred bash prompt layout and have tried to apply it to 2 different systems at work. However, it does not perform the same in both environments. As listed in the question, one is running 3.2.25 and the other 4.1.2. You may have guessed…
grail
  • 914
  • 6
  • 14
0
votes
1 answer

Customised command prompt is not saving chages after re-opening it

I am trying to use PS1 to customise my command prompt in mac, but the changes are not saved, when I try to re-open the terminal. I have edited the .bashrc file, and the changes are effective only for that session. If I close and re-open the…
Avijit Banerjee
  • 61
  • 1
  • 1
  • 4
0
votes
0 answers

Why is the terminal echoing my PS1 pattern at the start of every session?

I have a kind of complicated PS1 pattern: export PS1="\${debian_chroot:+(\$debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] \[$txtcyn\]\$git_branch\[$txtred\]\$git_dirty\[$txtrst\]\$ " Which is based off of the…
Patrick Flynn
  • 430
  • 2
  • 8
0
votes
2 answers

Anaconda Environment in prompt/PS1 in MacOS?

When I was in Ubuntu installing Anaconda and activating a virtual environment modified my prompt to look like that: (current-env)user@machine:dir or as you define in .bashrc. Now that I installed Anaconda in MacOS my prompt remain the same. I…
Andrea Bergonzo
  • 3,983
  • 4
  • 19
  • 31
0
votes
0 answers

ubuntu non-root user set PS1 variable?

When I was a root user,I can change my PS1 varialble like this but when I am not a root user,it seems strange for change PS1 variable. so,why?
elsonwx
  • 1,431
  • 3
  • 16
  • 26
0
votes
1 answer

Bash Git prompt does not hide outside of repository

my (simplified) PS1:export PS1="\A \w\ $(__git_ps1) \$ " prompt: 16:08-~/dev (master) $ This is all good and it shows branch name when there is one. But outside of the repo it still shows (master) instead of . I've been searching like crazy but…
ThaJay
  • 1,758
  • 1
  • 19
  • 30