11.4. Changing the Prompt Settings
All shells that I have seen, cmd.exe and UNIX shells included, have a mechanism to change the prompt string that gets displayed to the user before a command executes. Those shells allow users to configure the prompt by setting a global or an environment variable. For example, the cmd.exe default prompt has the $P$G value, where $P makes the shell print the current drive and path and $G prints the greater-than, or >, sign. The documentation lists several other options, all starting with a dollar sign, that one can use. UNIX shells, such as bash, offer a lot more options, but in essence, the approach is the same, including options and literal strings in a global variable. This approach has several disadvantages: ...
Get Pro Windows PowerShell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.