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 $
- 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 - about sar time display
- linux - how to check the terminal function
- linux - display order of the find command
- linux - i want to combine images taken at different times of the day into one image
- 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] if the result of the find command is piped
- python - i want to acquire a file by specifying a period from the date expression in the file name
- linux - about regular expressions when using ls
- linux - scripts running on my mac don't work on another mac
- linux - crontab does not work
- python - i want to fill in the missing numbers of files with consecutive dates using the file one day ago
- linux - save to a file with output in shell