Saturday, April 20, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 10628  / 2 Years ago, mon, november 15, 2021, 7:39:18

Need help to change the command prompt. I want short name. Look below :



kirti@kirti-Aspire-5733Z:~$ cd workspace
kirti@kirti-Aspire-5733Z:~/workspace$ cd Ruby
kirti@kirti-Aspire-5733Z:~/workspace/Ruby$


I am looking for my initial command prompt, when I will open it using 'Ctrl+Alt+t' as



 $(arup):
$(arup): cd workspace
$(workspace): cd Ruby
$(Ruby) :


In my ~/.bashrc file did put as below :



if [ "$color_prompt" = yes ]; then
PROMPT_DIRTRIM=1
PS1='w $ '
else
PS1='w $ '


By replacing



if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}[033[01;32m]u@h[033[00m]:[033[01;34m]w[033[00m]$ '
else
# PS1='${debian_chroot:+($debian_chroot)}u@h:w$ '
PS1='arup :w$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="[e]0;${debian_chroot:+($debian_chroot)}u@h: wa]$PS1"
;;
*)
;;
esac


But I didn't find any change in my shell:



enter image description here
May I have some help to configure the above settings ?


More From » bash

 Answers
3

I took help from How to: Change / Setup bash custom prompt (PS1)



I did first sudo gedit /etc/bashrc. Then did below change :



# set a fancy prompt (non-color, overwrite the one in /etc/profile)
# PS1='${debian_chroot:+($debian_chroot)}u@h:w$ '
PS1='(arup~>W)$'


Now my prompt is coming close to my expectation -



enter image description here


[#27744] Monday, November 15, 2021, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
fieldcheon

Total Points: 24
Total Questions: 105
Total Answers: 109

Location: Western Sahara
Member since Tue, Feb 16, 2021
3 Years ago
fieldcheon questions
Fri, Apr 1, 22, 05:58, 2 Years ago
Wed, Feb 2, 22, 03:31, 2 Years ago
Sat, Aug 14, 21, 01:24, 3 Years ago
;