我最近买了一个 Raspberry Pi,并开始玩它。更改我的 MOTD(包括颜色)后,颜色代码将作为原始文本出现而不是执行。
我在 Mac 终端中通过 SSH 连接到我的 Raspberry Pi。我也直接通过 Raspberries 命令行尝试过。我如何允许颜色?
下面是失败的 MOTD 的屏幕截图:
我正在编辑的文件是“/etc/motd”。我正在用“纳米”编辑它。
代码如下:
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
#!/bin/bash
echo "$(tput setaf 2)
.~~. .~~.
'. \ ' ' / .'$(tput setaf 1)
.~ .~~~..~.
: .~.'~'.~. :
~ ( …
Run Code Online (Sandbox Code Playgroud)