在*BSD上使用GUI的任何人是否可以确认,以下内容是否正确地适用于BSD系统?
我试图创建一个虚拟的*BSD测试盒,但最终失败了。因此,我耗尽了一些可用的资源,以便在*BSD上找到正确的tput序列.谢谢!
#!/bin/sh
if tput setaf > /dev/null 2>&1; then
# Linux tput
tput_number_of_colors=$(tput colors)
tput_cmd_set_fg_color='tput setaf'
tput_bold=$(tput bold)
tput_reset=$(tput sgr0)
elif tput AF > /dev/null 2>&1; then
# BSD tput
tput_number_of_colors=$(tput Co)
tput_cmd_set_fg_color='tput AF'
tput_bold=$(tput smso)
tput_reset=$(tput me)
else
# black & white console, or no tput
tput_number_of_colors=2
tput_cmd_set_fg_color=
tput_bold=
tput_reset=
fi
tput_test ()
# this function uses the above to test tput capability of the terminal
{
{ command -v tput && [ "$tput_number_of_colors" -ge 8 ] && $tput_cmd_set_fg_color 1 && echo "$tput_bold"; } > /dev/null 2>&1
}
if tput_test; then
# example of bold color definition
color_red=$tput_bold$($tput_cmd_set_fg_color $color_red_id)
fi发布于 2020-07-30 08:01:26
否:s/smso/so/ (术语名称总是两个字符)。终止(5)手册页是回答您的问题的地方,如所述。
手册页显示如下:
enter_bold_mode bold md turn on bold (extra
bright) mode这样,md将用于打开粗体模式。smso ( turns )或so (termcap)打开突出模式,您稍后可以在手册页中看到该模式不一定与粗体相同:
如果您的终端有一种或多种类型的显示属性,则可以用多种不同的方式表示这些属性。您应该选择一个显示形式作为突出模式,表示良好的、高对比度的、易于查看的、用于突出显示错误信息的格式和其他注意获取器。(如果你有选择的话,倒置视频加半亮视频是好的,或者仅仅是反向视频。)进入和退出突出模式的顺序分别为
smso和rmso。如果要更改为或退出突出模式的代码在屏幕上留下一个或两个空格,如TVI 912和Teleray 1061所做的那样,则应该给出xmc,以说明还剩下多少空格。
https://unix.stackexchange.com/questions/601031
复制相似问题