討論區: ヘルプ (Thread #49025)

Prompt customization (2023-04-09 02:40 by stalenstan #94940)

I understand that I should I create a my prompt as "PS1". However, I have no clue how to make it work.

I want my prompt to look as follows: "<user>:<cwd> " where <user> is green and <cwd> is blue and both are bold. I asked ChatGPT to help and it suggested the following:
PS1='\[\033[1;32m\]\u\[\033[0m\]:\[\033[1;34m\]\w\[\033[0m\] '
This didn't work, my prompt looked like: "033[1;32mu033[0m:033[1;34mw033[0m "

My .yashrc and .yash_profile are both empty (except for the PS1 initialisation in .yashrc).

回覆 #94940×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) 登入