> For the complete documentation index, see [llms.txt](https://sugar-at.gitbook.io/blog-article/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sugar-at.gitbook.io/blog-article/shell/5.md).

# 5. 输出彩色的内容

## 格式

echo -e "\033\[n1;n2;n3m字符串\033\[关闭属性"

* n1,n2,n3:为任意组合的数字
* 字体颜色范围:30-37
  * 30:黑色
  * 31:红色
  * 32:绿色
  * 33:黄色
  * 34:蓝色
  * 35:紫色
  * 36:天蓝色
  * 37:白色
* 背景色范围:40-47
  * 40:黑底
  * 41:红底
  * 42:绿底
  * 43:黄底
  * 44:蓝底
  * 45:紫底
  * 46:天蓝色低
  * 47:白底
* 特效范围:0,1,4,5
  * 0:无任何特效
  * 1:高亮(加粗)
  * 4:下划线
  * 5:闪烁

## 简单示例

```bash
# 红色字体
echo -e "\033[31m啦啦啦 \033[0m"

# 白底红字
echo -e "\033[47;31m白底红字内容 \033[0m"

# 白底红字下划线
echo -e "\033[4;31;47m测试内容 \033[0m"

# 下划线
echo -e "\033[4m下划线内容 \033[0m"
```

## 综合示例

模拟系统登入(带色),蓝底黄字输入用户名

```
read -p "`echo -e "\033[44;33m用户名: \033[0m"`"  username
read -p "密码:" -s password
echo "你输入的用户名$username"
echo "你输入的密码:$password"
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://sugar-at.gitbook.io/blog-article/shell/5.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
