From e0046f903a1a7fb63fe91e7d62b2e392f1bcef2a Mon Sep 17 00:00:00 2001 From: Dmitry Voronin Date: Sat, 14 Oct 2023 23:13:01 +0300 Subject: [PATCH] output_redirection : remove NOTE tag. --- help/linux/bash/basic/color.md | 30 +++++++++++++++++++++ help/linux/bash/basic/output_redirection.md | 2 +- help/linux/bash/color/todo.md | 1 - 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 help/linux/bash/basic/color.md delete mode 100644 help/linux/bash/color/todo.md diff --git a/help/linux/bash/basic/color.md b/help/linux/bash/basic/color.md new file mode 100644 index 0000000..96cf3f7 --- /dev/null +++ b/help/linux/bash/basic/color.md @@ -0,0 +1,30 @@ +# Bash colors. + +## How to use. +Most of the time you want to use it with `echo`. To make `echo` respect colors, you need to use `-e` flag like that: +```bash +export color_default="\033[0m" +export color_red="\033[0;31m" +echo -e "${color_red}hello world!${color_default}" # will print "hello world!" in red. +``` + +## List of colors. +Please note that colors depend on Terminal Emulator and may vary based on its settings. + +|Color|Code| +|---|---| +|default|`\033[0m`| +|blue|`\033[0;34m`| +|blue (bold)|`\033[1;34m`| +|cyan|`\033[0;36m`| +|cyan (bold)|`\033[1;36m`| +|green|`\033[0;32m`| +|green (bold)|`\033[1;32m`| +|purple|`\033[0;35m`| +|purple (bold)|`\033[1;35m`| +|red|`\033[0;31m`| +|red (bold)|`\033[1;31m`| +|white|`\033[0;37m`| +|white (bold)|`\033[1;37m`| +|yellow|`\033[0;33m`| +|yellow (bold)|`\033[1;33m`| diff --git a/help/linux/bash/basic/output_redirection.md b/help/linux/bash/basic/output_redirection.md index 83d62d6..d97c8c0 100644 --- a/help/linux/bash/basic/output_redirection.md +++ b/help/linux/bash/basic/output_redirection.md @@ -8,7 +8,7 @@ echo "hello" | base64 ## file. ```bash echo "hello" > file.txt # write "hello" to file.txt. -less < file.txt # read from file.txt and send to less. NOTE: program must support reading from stdin. +less < file.txt # read from file.txt and send to less. program must support reading from stdin. ``` ## output as argument. diff --git a/help/linux/bash/color/todo.md b/help/linux/bash/color/todo.md deleted file mode 100644 index 5ad0956..0000000 --- a/help/linux/bash/color/todo.md +++ /dev/null @@ -1 +0,0 @@ -TODO: add info about colors.