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
1 answer

Bash prompt (PS1) not working as intended

This is my .bashrc file, I'll explain my problem in a bit. #!/usr/bin/env bash PS_LINE=`printf -- ' %.0s' {1..200}` function parse_git_branch { PS_BRANCH='' PS_FILL=${PS_LINE:0:$COLUMNS} if [ -d .svn ] ; then PS_BRANCH="(svn…
KanseiKy
  • 23
  • 3
0
votes
0 answers

Some variables not showing in prompt (Bash)

Some variables aren't showing up, in this case, this PS_GIT variable #!/usr/bin/bash # Other codes # ... export USER="" export…
Askoi
  • 1
  • 1
0
votes
0 answers

export PS1 causes wrong history tracking

What is wrong with my PS1 ? export PS1='\[\033[01;34m\]\w \n\[\e[0;32m\$\e[m \]' When I run it i get the following multi line bash prompt. ~ $ But then If i try to go up in history using "Up Arrow" things go messy for example I can edit parts that…
KaO
  • 313
  • 1
  • 3
  • 13
0
votes
1 answer

How the PS1 of the title doesn't overwrite the PS1 of the prompt

I noticed that in ~/.bashrc there are two sets of PS1: if [ "$color_prompt" = yes ]; then PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' else …
E235
  • 11,560
  • 24
  • 91
  • 141
0
votes
0 answers

Change to elipses when setting PROMPT_DIRTRIM

PROMPT_DIRTRIM uses ... to denote truncated paths. I'd like to change the symbol to the ellipses character …
mu7z
  • 466
  • 5
  • 14
0
votes
2 answers

My custom prompt doesn't get updated after I hit enter?

I'm trying to make a custom prompt. When I hit enter certain values in the prompt should be updated, but its not getting updated. I tried adding export, like this export PS1="[$v0][$v1][$v2][$v3]$" But doesnt get updated. For example in the console…
anonD
  • 47
  • 8
0
votes
2 answers

PS1 on .zshrc outputs string instead of desired outputs

I'm using Mac OS Catalina. I tried editting .zshrc file with export PS1="\u \w \$ " and my expected output would be user desktop $. However the actual output was \u \w $. I don't understand why \u or \w is not working. .zshrc file is located in…
23open
  • 11
  • 1
0
votes
0 answers

Check Changes on Remote "asynchronously"?

I'm almost done constructing my own bash prompt. I understand how to parse git commands and show how ahead/behind one is from the remote. However, this is only useful if git fetch is first called, and I've seen some repos that do so asynchronously.…
0
votes
1 answer

How do I make the commands I enter bold in ZSH with oh-my-zsh?

I have configured PS1 and made the entire prompt bold .zshrc contains as follows PS1="%{$fg_bold[yellow]%}%n@%m %{$fg[blue]%}%~ \$ %{$reset_color%}%{$fg_bold[white]%}" preexec() { printf "\e[1m"; } Whatever I type in after the prompt is appearing…
Rvdixit23
  • 193
  • 9
0
votes
2 answers

Bash Exit Status Always Fails Comparison

In my .bashrc... 46 function exitstatus() 47 { 48 local a=0 49 local s=$1 50 s=$s+1 51 a=$a+1 52 echo -n ' arg1='$s' a='$a 53 s=$1 54 a=0 55 echo ' arg1='$s' a='$a 56 57 if [[ "$s" = "$a" ]]; then 58 echo "true" 59 else 60 echo…
0
votes
0 answers

Cutting the branch name in __git_ps1 function

I have a question related to the __git_ps1() function existing in the mingw64 terminal for git for windows application. I would like to have a part of the branch names to be shown. For example, suppose you work with Jira and your branches are…
arsdever
  • 1,111
  • 1
  • 11
  • 32
0
votes
2 answers

Correct return value in BASH prompt

This is part of a .bashrc file that sets a prompt, on a Ubuntu 19.10 machine: # Terminal tab name in gnome-terminal or Guake PROMPT_COMMAND='echo -ne "\033]0;$(basename ${PWD})\007"' GIT_PS1_SHOWCOLORHINTS=yes RET=\$? source…
snim2
  • 4,004
  • 27
  • 44
0
votes
2 answers

BASH print result of linux command in PS1 variable

I am trying to change my ps1 command prompt to print out the contents of pwd and also the result of the du command. I have tried adding this to my PS1 variable in my .bashrc file PS1='\[\033[01;32m\]\w\$(du -s `echo $PWD` 2>/dev/null | awk '{printf…
Jay Wehrman
  • 193
  • 2
  • 10
0
votes
1 answer

iTerm2 : Path into PS1 prompt is broken (\n) on different lines when it is too long

I am using iTerm2 on MacOS Catalina. Here is my PS1 into ~/.bashrc, using a function ps1 : function ps1 { # PROMPT SECTION BLUE='\[\033[0;34m\]' LIGHT_CYAN='\[\033[1;36m\]' DEFAULT='\[\033[0m\]' …
user1773603
0
votes
1 answer

Trying to change the color of bash prompt depending on CWD. Can't get it to update after changing directories

I have two storage drives and am trying to configure my bashrc file to do this: If the cwd is on drive B : Truncate the bash prompt to begin at the /home directory of the second drive Change the color of bash prompt to red to know I am working in…
Anon.
  • 85
  • 5