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

Conda activated environment but I can't see in command line

I have installed an virtual environment with conda and activate it with the following command lines conda create -n test1 python=2 anaconda source activate test1 or conda activate test1 and when I activate it and run conda env list, it shows me…
kobi
  • 13
  • 4
1
vote
0 answers

Error PS1 git functions - conflict between Gitbash vs Cygwin

I'm receiving the following error trying to customize my PS1 for git Error: bash: command substitution: line 1: syntax error near unexpected token `)' bash: command substitution: line 1: `get_dir)' bash: command substitution: line 1: syntax error…
1
vote
2 answers

Multiple substring replacement in bash

I'm working in an HPC cluster which has a lot of partitions ($HOME, $SCRATCH, $WORKDIR, $SHARED,...) and was trying to find a way to clearly identify which partition I'm at the moment. After some digging, I found that export PS1="\e[33;1m\u@\h:…
1
vote
1 answer

Sorting string of numeric in powershell

I have retrieved an array of strings that are 0.0.1 0.0.10 0.0.2 Since this is string with multiple dots I had to remove dots to compare them which I did it following way $array = $r.Links.outerText.replace('/','') | Where {$_ -notmatch $filter} |…
user1298426
  • 3,467
  • 15
  • 50
  • 96
1
vote
1 answer

Format python virtual environment name with shell variable PS1 on bash prompt

I'm trying to customize the bash prompt with the shell variable PS1. How can I access the python virtual environment name to apply color formatting? PS1 is set to: \u@\h in \W \$ I would expect the output to be user@host in ~ $ But I get (base)…
coemu
  • 195
  • 1
  • 11
1
vote
1 answer

Converting New-SelfSignedCertificate to X509Certificate2 : some options available in ps1 are missing in C#

I am trying to replace the existing ps1 script that creates self signed certificate with C# code. There are quite a lot of references like this that describes bulk of creating self-signed certificate using C# with .NET. However there are couple of…
Shintaro Takechi
  • 1,215
  • 1
  • 17
  • 39
1
vote
2 answers

Setting value of command prompt ( PS1) based on present directory string length

I know I can do this to reflect just last 2 directories in the PS1 value. PS1=${PWD#"${PWD%/*/*}/"}# but lets say we have a directory name that's really messy and will reduce my working space ,…
user1874594
  • 2,277
  • 1
  • 25
  • 49
1
vote
1 answer

Mac OS Catalina: PS1 not updating when I change branch or directory

I tried to set PS1 in the bash_profile as, .bash_profile #!/bin/bash # ..... parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' } parse_pwd() { basename $PWD } PS1=''$(parse_pwd)''$(parse_git_branch)' $…
Amarnath
  • 8,736
  • 10
  • 54
  • 81
1
vote
1 answer

How do I pass a font color and style from bash variable to the PS1 prompt

I want to set a sub portion of my PS1 prompt string to a specific color/style that is chosen by passing into a bash function. It is easy for me to explicitly put the color in the PS1 variable directly. However, when I to do this using a bash…
EmceeBC
  • 71
  • 4
1
vote
0 answers

When setting up .bashrc on Windows for Git Bash, why is a function in PS1 showing the function name rather than evaluating?

Below is what I currently have in the .bashrc file located in my home directory. parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'; } PS1='\n' # New…
Kistler21
  • 11
  • 2
1
vote
2 answers

Changing vowels to numbers in Bash prompt PS1

I am trying to change my user prompt bash so that instead of showing up the vowels, it shows the number corresponding to that vowel. So, a -> 1, e -> 2, i -> 3, o -> 4, u -> 5. So far what I achieved is all the vowels with the same number as you can…
js352
  • 364
  • 2
  • 9
1
vote
1 answer

getting a  ? and a [✘?] instead of just the branch icon and the branch name on zsh

I was just trying to learn git, and the guy on the tutorial talked about zsh, so I followed a tutorial to install it and I am getting a  ?[✘?] instead of the branch name on zsh shell. what should I do?
Hakumai
  • 21
  • 1
  • 3
1
vote
2 answers

Change last character's color of PS1v promt based on exit status of previous command

I've customized my .bashrc settings similar to default's PS1 settings from Clear Linux. My file contents these lines: EXIT="$?" BLUE="\[\e[38;5;39m\]" RED="\[\e[31m\]" ORANGE="\[\e[38;5;208m\]" WHITE="\[\e[0m\]" if [ "$EXIT" = "0" ]; then …
user14241752
1
vote
1 answer

Display detached heads elegantly in CLI

I'd like my commandline (PS1 variable) to display detached heads more elegantly, even if it's a little more ambiguous. The reason I want to do this is because while I never work on detached branches, I frequently encounter them due to our project…
Addison
  • 7,322
  • 2
  • 39
  • 55
1
vote
1 answer

Why would sed have trouble seeing my PS1 prompt?

I'm trying to use sed as root to alter the default PS1. The first 2 lines were just to make sure I had the syntax structured right and to see if the quotation marks made a difference, running them consecutively allows me to change a comment near the…
TurtleWolfe
  • 125
  • 1
  • 12