こんにちは。
シェルスクリプトを基にして、使用方法説明(ヘルプメッセージ)を作るよう ChatGPT へ依頼し、概ね良好な回答を得ました。
ChatGPT への質問
文字色を指定する次のシェルスクリプトを基にして、ヘルプメッセージを作ってください。
#!/bin/sh
text_style_f() {
ESC=$(printf '\e')
printf "${ESC}[%dm" "$1"
}
text_color_f() {
style="$(text_style_f $1)"
NORMALFACE="$(text_style_f 0)"
printf "$style%d$NORMALFACE" "$1"
}
for i in $(seq 30 37); do text_color_f "$i "; done; echo
for i in $(seq 90 97); do text_color_f "$i "; done; echo
ChatGPT からの回答
了解しました!
Usage:
$PROGNAME [options]
Description:
This script displays ANSI color codes for foreground text colors in the terminal.
It prints numbers 30–37 (standard foreground colors) and 90–97 (bright foreground colors),
each rendered in its corresponding color using ANSI escape sequences.
The output helps users visualize and choose appropriate ANSI color codes
for customizing terminal prompts, scripts, or UI elements.
Options:
-h|--help Print this usage and exit.