ps1 Questions

3

Solved

I want to change my PS1 in my .bashrc file. I've found a script using printf with %q directive to escape characters : #!/bin/bash STR=$(printf "%q" "PS1=\u@\h:\w\$ ") sed -i '/PS1/c\'"$STR" ~/.bas...
Hungary asked 26/9, 2014 at 22:8

13

Solved

I am using Ubuntu and I am tired of this long prompts in bash when I am working with some deep directory hierarchy. So, I would like to tweak my PS1 to shorten the working directory part the follow...
Voltz asked 16/4, 2011 at 15:17

4

Solved

Newbie question, I recently changed my PS1 into this: RESET="\[\017\]" NORMAL="\[\033[0m\]" YELLOW="\[\033[0;33m\]" CYAN="\[\033[0;36m\]" export PS1="\[$RESET\]\u@\h:\[$CYAN\]\w\[$YELLOW\]\$(__gi...
Scherman asked 1/9, 2013 at 14:34

2

Solved

I created an anaconda environment in a project folder specifying the path with -p option, i.e. not in the default anaconda3/envs folder: conda create -p venv The problem is that when I activate ...
Cityscape asked 16/6, 2019 at 13:36

2

Solved

Say I have this as my PS1 PS1='\[\e]0;TITLE\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ ' it will give me this prompt Steven@Steven-PC ~ $ with a window title as TITLE I understand that this p...
Tool asked 4/5, 2012 at 21:14

5

Solved

I use zsh but not equipted with oh-my-zsh, since I cloned many git repos on my machine and oh-my-zsh's default theme or 'josh' theme makes it very slow, for cd and ls commands, etc. Thus I delete ...
Farly asked 25/11, 2019 at 13:36

6

It seems that by executing code in PS0 and PS1 variables (which are eval'ed before and after a prompt command is run, as I understand) it should be possible to record time of each running command a...
Mister asked 4/4, 2017 at 7:48

1

Solved

I am trying to setup a PowerShell script that would replace a matching string from my GlobalAssemblyInfo.cs file. I am basically looking to update the Version number via powershell so I can do that...
Hillard asked 8/3, 2022 at 18:30

1

Solved

$password = ConvertTo-SecureString “Password+++” -AsPlainText -Force $Cred = New-Object System.Management.Automation.PSCredential ("Admin", $password) $FileLocale = Split-Path -Parent -Pa...
Arrowroot asked 15/2, 2022 at 14:8

7

Solved

I have a shell script that runs the same command in several directories (fgit). For each directory, I would like it to show the current prompt + the command which will be run there. How do I get th...
Barney asked 10/8, 2010 at 18:5

21

Solved

I'm trying to change my command promt in terminal. I keep getting the error: -bash: __git_ps1: command not found I've tried it just by typing it into the terminal as is: __git_ps1. I've also tried ...
Peppercorn asked 13/10, 2012 at 7:20

4

Solved

I am trying to set PS1 so that it prints out something just right after login, but preceded with a newline later. Suppose export PS1="\h:\W \u\$ ", so first time (i.e., right after login) you get:...
Hairstyle asked 13/2, 2013 at 17:17

3

Solved

This command succeeds $ PS1='$(date +%s) $ ' 1391380852 $ However if I add a newline it fails $ PS1='$(date +%s)\n$ ' bash: command substitution: line 1: syntax error near unexpected token `)...
Knave asked 2/2, 2014 at 22:46

6

Solved

You can use \d in the your PS1 confuration to display a long date ie. Tues 18 May, but how can I get it to display it in a format like 18.05.2012 for example?
Sollie asked 8/2, 2012 at 20:26

1

Solved

How can I edit the conda prompt's behavior without touching my normal prompt? I want to retain conda's prepend-to-PS1 behavior, but change the string that gets prepended. The question how to modify...
Booted asked 10/7, 2020 at 21:29

1

My PS1 variable cannot parsed correctly, it looks like this, \[\033[01;32m\]\u@\h\[\033[01;34m\] [\w]\[\033[00m\] \[\033[01;32m\]\u@\h\[\033[01;34m\] [\w]\[\033[00m\] \[\033[01;32m\]\u@\h\[\033[01...
Norway asked 1/12, 2019 at 3:18

6

Solved

I know you can edit the bash prompt permanently by editing the PS1 variable in your ~/.bashrc file, mine looks like this: PS1="\[\e[0;31m\]<HERP(._.)DERP>\[\e[0;0m\]"; but can you set a t...
Acedia asked 19/11, 2012 at 18:32

1

Solved

My .bashrc: # show a short way shortwd() { num_dirs=3 pwd_symbol="..." newPWD="${PWD/#$HOME/~}" if [ $(echo -n $newPWD | awk -F '/' '{print NF}') -gt $num_dirs ]; then newPWD=$(echo -n $newPW...
Deathday asked 21/11, 2019 at 11:2

2

I want to use an American flag emoji in my bash prompt (i.e. PS1 environment variable). However, the American flag emoji causes the terminal cursor to offset an extra character to the right. 🇺🇸 ...
Semiporcelain asked 31/1, 2019 at 0:22

6

Solved

The question is simple. I want to evaluate current value of PS1 in my bash script. All materials on google point to tutorials on pimping it up, but I want to evaluate to see how would it be rendere...
Odisodium asked 11/3, 2014 at 10:24

2

How can I change the prompt of my zsh shell while still retaining the cool coloring that agnoster provides? For people who don't know, it looks like this I want to add some things like ! and \u be...
Aleece asked 12/12, 2013 at 10:13

8

Solved

I'm looking for a bash function that will shorten long path names to keep my PS1 variable from getting excessively long. Something along the lines of: /this/is/the/path/to/a/really/long/directory/...
Scissor asked 24/10, 2009 at 1:23

2

Solved

my current bash ps1 is as follows: bldred='\e[1;31m' # Red bldcyn='\e[1;36m' # Cyan bldwht='\e[1;37m' # White txtrst='\e[0m' # Text Reset - Useful for avoiding color bleed export PS1="\n\[$bldred...
Electric asked 27/2, 2017 at 9:12

2

Solved

\h is a bash prompt escape sequence that expands to the hostname. Where does it get the hostname from? On my system it shows a value that I cannot find anywhere, not in hostname -f or /etc/hosts or...
Gide asked 1/11, 2017 at 18:49

5

Solved

Consider this PS1 PS1='\n${_:+$? }$ ' Here is the result of a few commands $ [ 2 = 2 ] 0 $ [ 2 = 3 ] 1 $ 1 $ The first line shows no status as expected, and the next two lines show the cor...
Enchilada asked 9/12, 2014 at 17:10

© 2022 - 2024 — McMap. All rights reserved.