I want to display the prompt (display name) in Bash terminal like
The prompt is currently set as follows in
export PS1 = "\ W \ $"
This makes the prompt look like
currrentDirectory $(for example,
I want to change this display like
I don't know how to do this with regular expressions, so I'm going to ask you a question here.
MacOS Mojave v10.14.6
- Terminal → iterm2 (Bash)
Answer # 1
PS1 = '$(pwd | sed -e "s,. */\ (. * \) \ (/.*$\), \ 1 \ 2, g ") $'
How about (maybe there is a better way of writing).
/$cd / / $cd/usr / / usr $cd/usr/share / usr/share $cd/usr/share/doc share/doc $
- i want to display a message by exception handling in linux if else
- linux - how to display and arrange the docker icon on centos8 desktop?
- linux - to display the app icon on the centos 8 desktop
- display png image on linux
- linux - option to display only unit and startup status with systemctl status
- i want to use the linux tree command on a windows vs code terminal
- i want to display the log in another terminal with python
- python - i want to display anaconda prompt and powershell at the same time with vscode
- mysql - sequelpro, how to display database list in terminal
- linux - i want to display the result of ssh command in a message box in python3 paramiko module
- i want to output the linux command (tool?) to a file instead of the terminal
- Linux execution executable file prompt No such file or directory solution
- i want to display users with the linux command history
- linux - some commands are executed by crontab and some are not
- i want to call the argument of the python script executed on the terminal in the code and omit it
- linux - i want to combine images taken at different times of the day into one image
- linux : How to display in the terminal the rights of a specific user for a specific file?
- linux - retry process in for statement
- linux - how to restrict ip connection to telnet on centos 822
- linux - array is garbled in shell script
- perl - extraction and processing from a text file under multiple specified conditions
- linux - i want to download images from my vpn to my mac by rsync etc
- linux - unable to save initel file in emacs i want to know how to solve write-protected