summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Ball <nullspoon@oper.io>2019-03-14 14:04:07 -0600
committerAaron Ball <nullspoon@oper.io>2019-03-14 15:02:37 -0600
commit60cd273609fef6e5ce243d3adc98cb2548c845f1 (patch)
tree3d4be7969e00461d55f88b37a9481423d32fd6aa
parent508c1bccbf61a3994a2c5679cc8a3e114f9021d7 (diff)
downloadoper.io-60cd273609fef6e5ce243d3adc98cb2548c845f1.tar.gz
oper.io-60cd273609fef6e5ce243d3adc98cb2548c845f1.tar.xz
detecting stdout escape char support: Updated terminal formatting
-rw-r--r--posts/linux_development:detecting_stdout_escape_char_support.adoc27
1 files changed, 13 insertions, 14 deletions
diff --git a/posts/linux_development:detecting_stdout_escape_char_support.adoc b/posts/linux_development:detecting_stdout_escape_char_support.adoc
index 192eaab..06174fa 100644
--- a/posts/linux_development:detecting_stdout_escape_char_support.adoc
+++ b/posts/linux_development:detecting_stdout_escape_char_support.adoc
@@ -2,7 +2,6 @@ Linux Development:Detecting STDOUT Escape Char Support
======================================================
:author: Aaron Ball
:email: nullspoon@oper.io
-:revdate: January 18, 2017
If you've spent much time in the command line, especially if you script, you
@@ -19,30 +18,30 @@ For example, a script like this...
----
#!/usr/bin/env bash
-echo -e "[ \e[32mINFO\e[0m ] This is a useful info message."
-echo -e "[ \e[33mWARN\e[0m ] This is an ominous warning message."
-echo -e "[ \e[31mERROR\e[0m ] This is a scary error message."
+echo -e "\e[32mINFO\e[0m This is a useful info message."
+echo -e "\e[33mWARN\e[0m This is an ominous warning message."
+echo -e "\e[31mERROR\e[0m This is a scary error message."
----
Outputs something like this in the terminal
-[role="terminal"]
-====
-[ [green]#INFO# ] This is a useful info message.
+[.terminal]
+--
+[green]#INFO# This is a useful info message.
-[ [yellow]#WARN# ] This is an ominous warning message.
+[yellow]#WARN# This is an ominous warning message.
-[ [red]#ERROR# ] This is a scary error message.
-====
+[red]#ERROR# This is a scary error message.
+--
...But something like this when piped to less
[role="terminal"]
----
-[^[[32mINFO^[[0m] This is a useful info message.
-[^[[33mWARN^[[0m] This is an ominous warning message.
-[^[[31mERROR^[[0m] This is a scary error message.
+^[[32mINFO^[[0m This is a useful info message.
+^[[33mWARN^[[0m This is an ominous warning message.
+^[[31mERROR^[[0m This is a scary error message.
----
@@ -146,5 +145,5 @@ device, it is safe to assume it does not support escape character formatting.
[role="datelastedit"]
-Last edited: {revdate}
+Last edited: {docdate} {doctime}
// vim: set syntax=asciidoc:

Generated by cgit