- 0
- 0
- 约1.15万字
- 约 8页
- 2023-04-24 发布于上海
- 举报
Disclaimer :
Disclaimer : The original version of this article was first published on IBM developerWorks, and is property of Westtech Information Services. This document is an updated version of the original article, and contains various improvements made by the Gentoo Linux Documentation team.
This document is not actively maintained.
Prompt magic
1. Enhancing the system prompt
As Linux/UNIX people, we spend a lot of time working in the shell, and in many cases, this is what we have staring back at us:
Code Listing 1.1: The normal user prompt bash-2.04$
Code Listing 1.1: The normal user prompt bash-2.04$
If you happen to be root, youre entitled to the prestige version of this beautiful prompt:
Code Listing 1.2: The root prompt bash-2.04#
Code Listing 1.2: The root prompt bash-2.04#
These prompts are not exactly pretty. Its no wonder that several Linux distributions have upgraded their default prompts that add color and additional information to boot. However, even if you happen to have a modern distribution that comes with a nice, colorful prompt, it may not be perfect. Maybe youd like to add or change some colors, or add (or remove) information from the prompt itself. It isnt hard to design your own colorized, tricked-out prompt from scratch.
Prompt basics
Under bash, you can set your prompt by changing the value of the PS1 environment variable, as follows:
Code Listing 1.3: Altering the environment variable
Code Listing 1.3: Altering the environment variable
$ export PS1=
Changes take effect immediately, and can be made permanent by placing the export definition in your ~/.bashrc file. PS1 can contain any amount of plain text that youd like:
Code Listing 1.4: A custom prompt
Code Listing 1.4: A custom prompt
$ export PS1=This is my super prompt This is my super prompt
While this is, um,interesting, its not exactly useful to have a prompt that contains lots of static text. Most custom prompts contain information like the current username, working directory,
您可能关注的文档
- 20000字起笔部首检字表.docx
- 20148小继教培训心得体会.docx
- 20151人教版三年级数学上册教学工作总结.docx
- 20165理论题分析和总结.docx
- 20192广东公需课 中华传统美德.docx
- 22018年黄浦区中考物理二模卷含答案.docx
- 070602EditPlus安装步骤分析和总结.docx
- 100128万达国际时报文案.docx
- 100413晨报万达软文.docx
- 00192006中国软件企业出口20强等.docx
- 中国国家标准 GB/Z 37551.300-2026海洋能 波浪能、潮流能及其他水流能转换装置 第300部分:河流能转换装置发电性能评估.pdf
- GB/T 44937.3-2025集成电路 电磁发射测量 第3部分:辐射发射测量 表面扫描法.pdf
- 中国国家标准 GB/T 44937.3-2025集成电路 电磁发射测量 第3部分:辐射发射测量 表面扫描法.pdf
- 《GB/T 44937.3-2025集成电路 电磁发射测量 第3部分:辐射发射测量 表面扫描法》.pdf
- 中国国家标准 GB/T 44937.1-2025集成电路 电磁发射测量 第1部分:通用条件和定义.pdf
- GB/T 44937.1-2025集成电路 电磁发射测量 第1部分:通用条件和定义.pdf
- 《GB/T 44937.1-2025集成电路 电磁发射测量 第1部分:通用条件和定义》.pdf
- 中国国家标准 GB/T 4937.37-2025半导体器件 机械和气候试验方法 第37部分:采用加速度计的板级跌落试验方法.pdf
- 《GB/T 4937.10-2025半导体器件 机械和气候试验方法 第10部分:机械冲击 器件和组件》.pdf
- 中国国家标准 GB/T 44937.2-2025集成电路 电磁发射测量 第2部分:辐射发射测量TEM小室和宽带TEM小室法.pdf
原创力文档

文档评论(0)