diff options
author | garhve <git@garhve.com> | 2022-12-02 22:50:35 +0800 |
---|---|---|
committer | garhve <git@garhve.com> | 2022-12-02 22:50:35 +0800 |
commit | d60811a78a56fcfc39d573d626c097301ef6585f (patch) | |
tree | d78a1972f29ec2094b7dc3d6f13b12fb48b39525 | |
parent | 924132dc97988d9c5ae37cb05fa7e2eb35e28276 (diff) |
blog transfer
-rw-r--r-- | en/sitemap.xml | 17 | ||||
-rw-r--r-- | index.html | 43 | ||||
-rw-r--r-- | index.xml | 38 | ||||
-rw-r--r-- | posts/1/index.html | 4 | ||||
-rw-r--r-- | posts/4/index.html | 24 | ||||
-rw-r--r-- | posts/5/index.html | 1450 | ||||
-rw-r--r-- | posts/6/index.html | 359 | ||||
-rw-r--r-- | posts/7/index.html | 164 | ||||
-rw-r--r-- | posts/index.html | 43 | ||||
-rw-r--r-- | posts/index.xml | 38 | ||||
-rw-r--r-- | sitemap.xml | 2 |
11 files changed, 2156 insertions, 26 deletions
diff --git a/en/sitemap.xml b/en/sitemap.xml index fe471c0..76a0a21 100644 --- a/en/sitemap.xml +++ b/en/sitemap.xml @@ -2,11 +2,8 @@ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml"> <url> - <loc>https://blog.garhve.com/posts/4/</loc> - <lastmod>2022-09-03T14:33:37+08:00</lastmod> - </url><url> <loc>https://blog.garhve.com/</loc> - <lastmod>2022-09-03T14:33:37+08:00</lastmod> + <lastmod>2022-11-07T09:16:15+08:00</lastmod> <xhtml:link rel="alternate" hreflang="cn" @@ -18,7 +15,19 @@ href="https://blog.garhve.com/" /> </url><url> + <loc>https://blog.garhve.com/posts/7/</loc> + <lastmod>2022-11-07T09:16:15+08:00</lastmod> + </url><url> <loc>https://blog.garhve.com/posts/</loc> + <lastmod>2022-11-07T09:16:15+08:00</lastmod> + </url><url> + <loc>https://blog.garhve.com/posts/6/</loc> + <lastmod>2022-09-29T09:43:02+08:00</lastmod> + </url><url> + <loc>https://blog.garhve.com/posts/5/</loc> + <lastmod>2022-09-12T09:02:06+08:00</lastmod> + </url><url> + <loc>https://blog.garhve.com/posts/4/</loc> <lastmod>2022-09-03T14:33:37+08:00</lastmod> </url><url> <loc>https://blog.garhve.com/posts/3/</loc> @@ -29,8 +29,8 @@ "accountablePerson" : "garhve", "copyrightHolder" : "garhve", "copyrightYear" : "2022", - "datePublished": "2022-09-03 14:33:37 \u002b0800 CST", - "dateModified" : "2022-09-03 14:33:37 \u002b0800 CST", + "datePublished": "2022-11-07 09:16:15 \u002b0800 CST", + "dateModified" : "2022-11-07 09:16:15 \u002b0800 CST", "url" : "https:\/\/blog.garhve.com\/", "keywords" : [ ] } @@ -95,6 +95,45 @@ <div class="row posts-line"> <div class="posts-date col-xs-6 col-sm-2"> + <time datetime="2022-11-07 09:16:15 CST">Nov 07</time> + </div> + <div class="posts-title col-xs-9 col-sm-10"> + <div class="row"> + <div class="col-xs-11 col-sm-10"> + <a href="/posts/7/">Past Is Great</a> + </div> + </div> + </div> + </div> + + <div class="row posts-line"> + <div class="posts-date col-xs-6 col-sm-2"> + <time datetime="2022-09-29 09:43:02 CST">Sep 29</time> + </div> + <div class="posts-title col-xs-9 col-sm-10"> + <div class="row"> + <div class="col-xs-11 col-sm-10"> + <a href="/posts/6/">Mess with Bash(2)</a> + </div> + </div> + </div> + </div> + + <div class="row posts-line"> + <div class="posts-date col-xs-6 col-sm-2"> + <time datetime="2022-09-12 09:02:06 CST">Sep 12</time> + </div> + <div class="posts-title col-xs-9 col-sm-10"> + <div class="row"> + <div class="col-xs-11 col-sm-10"> + <a href="/posts/5/">Escape Sequences</a> + </div> + </div> + </div> + </div> + + <div class="row posts-line"> + <div class="posts-date col-xs-6 col-sm-2"> <time datetime="2022-09-03 14:33:37 CST">Sep 03</time> </div> <div class="posts-title col-xs-9 col-sm-10"> @@ -6,7 +6,43 @@ <description>Recent content on blog | garhve's hub</description> <generator>Hugo -- gohugo.io</generator> <language>en-us</language> - <lastBuildDate>Sat, 03 Sep 2022 14:33:37 +0800</lastBuildDate><atom:link href="https://blog.garhve.com/index.xml" rel="self" type="application/rss+xml" /> + <lastBuildDate>Mon, 07 Nov 2022 09:16:15 +0800</lastBuildDate><atom:link href="https://blog.garhve.com/index.xml" rel="self" type="application/rss+xml" /> + <item> + <title>Past Is Great</title> + <link>https://blog.garhve.com/posts/7/</link> + <pubDate>Mon, 07 Nov 2022 09:16:15 +0800</pubDate> + + <guid>https://blog.garhve.com/posts/7/</guid> + <description>Lately, there’s a sign has been keeping jumping out in front of my eyes. That the past is great! +First is in the movie Midnight in Paris, directed by Woody Allen, which I just finished a week ago. It tells a story of how a screen writer love 20th century because his loving artists all living in it. Though he finally realize that he loves past because the present is imperfect.</description> + </item> + + <item> + <title>Mess with Bash(2)</title> + <link>https://blog.garhve.com/posts/6/</link> + <pubDate>Thu, 29 Sep 2022 09:43:02 +0800</pubDate> + + <guid>https://blog.garhve.com/posts/6/</guid> + <description>More info is in this tutorial +all value expansions (ie. all syntax with a $ prefix) can only expand inside quoted arguments if the argument was double-quoted . Single quotes will turn the dollar-syntax into literal characters, causing bash to output the dollar rather than expand its value in-place! +&ldquo;Value expansions ($...) must always be double-quoted.&rdquo; +Never leave a value expansion unquoted. +Redirection File Redirection 0 is standard input, 1 is standard output, 2 is standard error</description> + </item> + + <item> + <title>Escape Sequences</title> + <link>https://blog.garhve.com/posts/5/</link> + <pubDate>Mon, 12 Sep 2022 09:02:06 +0800</pubDate> + + <guid>https://blog.garhve.com/posts/5/</guid> + <description>copied from github in case one day it disappears +more information could visit vt100 User Guide +ANSI Escape Sequences Standard escape codes are prefixed with Escape: +Ctrl-Key: ^[ Octal: \033 Unicode: \u001b Hexadecimal: \x1B Decimal: 27 Followed by the command, somtimes delimited by opening square bracket ([), known as a Control Sequence Introducer (CSI), optionally followed by arguments and the command itself. +Arguments are delimeted by semi colon (;).</description> + </item> + <item> <title>Architecture of Linux Kernel</title> <link>https://blog.garhve.com/posts/4/</link> diff --git a/posts/1/index.html b/posts/1/index.html index d8f4fef..b6a47de 100644 --- a/posts/1/index.html +++ b/posts/1/index.html @@ -152,8 +152,8 @@ Due to personal interest, I didn&rsquo;t choose frame to base my website. I </span></span><span style="display:flex;"><span> <span style="font-weight:bold">listen</span> 443 <span style="font-style:italic">ssl</span> <span style="font-style:italic">http2</span>; </span></span><span style="display:flex;"><span> <span style="font-weight:bold">listen</span> <span style="font-style:italic">[::]:443</span> <span style="font-style:italic">ssl</span> <span style="font-style:italic">http2</span>; </span></span><span style="display:flex;"><span> -</span></span><span style="display:flex;"><span> <span style="font-weight:bold">server_name</span> <span style="font-style:italic">garhve.com</span> -</span></span><span style="display:flex;"><span> <span style="font-style:italic">include</span> <span style="font-style:italic">/path_to_cert_file</span>; +</span></span><span style="display:flex;"><span> <span style="font-weight:bold">server_name</span> <span style="font-style:italic">garhve.com</span>; +</span></span><span style="display:flex;"><span> <span style="font-weight:bold">include</span> <span style="font-style:italic">/path_to_cert_file</span>; </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span> <span style="font-style:italic">#location to real content </span></span></span><span style="display:flex;"><span><span style="font-style:italic"></span>} <span style="font-style:italic"># this block is where we hold web content. diff --git a/posts/4/index.html b/posts/4/index.html index 2e314e2..b9d798a 100644 --- a/posts/4/index.html +++ b/posts/4/index.html @@ -58,6 +58,17 @@ User space: For applications to run in unprivileged user mode Kernel space: For <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.3/dist/contrib/auto-render.min.js" integrity="sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05" crossorigin="anonymous" onload="renderMathInElement(document.body);"></script> </head> + + <script> +document.addEventListener("DOMContentLoaded", function() { + renderMathInElement(document.body, { + delimiters: [ + {left: "$$", right: "$$", display: true}, + {left: "$", right: "$", display: false} + ] + }); +}); +</script> </html> @@ -146,19 +157,6 @@ User space: For applications to run in unprivileged user mode Kernel space: For System calls APIs: man section 2</p> </blockquote> <p>to be continue…</p> -<p>\documentclass[12pt,twoside,a4paper]{article} -\begin{document} -\begin{tabular}{|c|c|c|} -\hline -A & B & C \ -\hline -1 & 2 & 3 \ -\hline -4 & 5 & 6 -\ -\hline -\end{tabular} -\end{document}</p> </div> diff --git a/posts/5/index.html b/posts/5/index.html new file mode 100644 index 0000000..8d9484a --- /dev/null +++ b/posts/5/index.html @@ -0,0 +1,1450 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8" /> + <meta name="generator" content="Hugo 0.105.0"> + + <meta http-equiv="X-UA-Compatible" content="IE=edge" /> + <meta name="viewport" content="width=device-width, initial-scale=1" /> + <meta name="author" content="garhve" /> + <meta property="og:url" content="https://blog.garhve.com/posts/5/" /> + <link rel="canonical" href="https://blog.garhve.com/posts/5/" /><link rel="alternate" type="application/atom+xml" href="https://blog.garhve.comindex.xml" title="blog | garhve's hub"> + + <script type="application/ld+json"> + { + "@context" : "http://schema.org", + "@type" : "BlogPosting", + "mainEntityOfPage": { + "@type": "WebPage", + "@id": "https:\/\/blog.garhve.com" + }, + "articleSection" : "posts", + "name" : "Escape Sequences", + "headline" : "Escape Sequences", + "description" : "copied from github in case one day it disappears\nmore information could visit vt100 User Guide\nANSI Escape Sequences Standard escape codes are prefixed with Escape:\nCtrl-Key: ^[ Octal: \\033 Unicode: \\u001b Hexadecimal: \\x1B Decimal: 27 Followed by the command, somtimes delimited by opening square bracket ([), known as a Control Sequence Introducer (CSI), optionally followed by arguments and the command itself.\nArguments are delimeted by semi colon (;).", + "inLanguage" : "en-US", + "author" : "garhve", + "creator" : "garhve", + "publisher": "garhve", + "accountablePerson" : "garhve", + "copyrightHolder" : "garhve", + "copyrightYear" : "2022", + "datePublished": "2022-09-12 09:02:06 \u002b0800 CST", + "dateModified" : "2022-09-12 09:02:06 \u002b0800 CST", + "url" : "https:\/\/blog.garhve.com\/posts\/5\/", + "keywords" : [ ] + } +</script> +<title>Escape Sequences</title> + <meta property="og:title" content="Escape Sequences" /> + <meta property="og:type" content="article" /> + <meta property="og:description" content="copied from github in case one day it disappears +more information could visit vt100 User Guide +ANSI Escape Sequences Standard escape codes are prefixed with Escape: +Ctrl-Key: ^[ Octal: \033 Unicode: \u001b Hexadecimal: \x1B Decimal: 27 Followed by the command, somtimes delimited by opening square bracket ([), known as a Control Sequence Introducer (CSI), optionally followed by arguments and the command itself. +Arguments are delimeted by semi colon (;)." /> + <meta name="description" content="copied from github in case one day it disappears +more information could visit vt100 User Guide +ANSI Escape Sequences Standard escape codes are prefixed with Escape: +Ctrl-Key: ^[ Octal: \033 Unicode: \u001b Hexadecimal: \x1B Decimal: 27 Followed by the command, somtimes delimited by opening square bracket ([), known as a Control Sequence Introducer (CSI), optionally followed by arguments and the command itself. +Arguments are delimeted by semi colon (;)." /> + <meta property="og:locale" content="en-us" /><meta property="og:image" content="" /> + + + + + <style>body{font-family:bree serif,sans-serif;-webkit-font-smoothing:antialiased;margin:0 20px}article{max-width:800px;margin-left:auto;margin-right:auto}a{color:#000;text-decoration:none}a:hover{font-weight:600;text-decoration:underline}.post-ads{margin:50px 0}.markdown-body{font-size:18px;max-width:100%}.markdown-body a{text-decoration:underline;text-decoration-color:#000}.markdown-body blockquote{margin:0;padding:0 1em;color:#57606a;border-left:.25em solid #d0d7de}.markdown-body pre{padding:16px;overflow:auto;border-radius:10px}.markdown-body code{padding:.2em .4em;font-size:85%;background-color:#f6f8fa;border-radius:6px;font-family:fira code,monospace}.markdown-body pre>code{padding:0;font-size:80%;background-color:inherit;border:0;font-family:fira code,monospace}.Chinese .markdown-body{line-height:200%}.site-date-catalog{font-size:2rem}.header-title{font-size:2rem;font-weight:700;margin-top:32px;font-family:bungee shade,sans-serif}.header-title a{text-decoration:none}.header-subtitle{color:#666}.header-items{margin:10px 0}.header-item{margin:0 5px}.header-line{width:100%;border-width:2px;border-color:#482936;border-style:solid none none none}.lang-switch{font-weight:600}#posts-list{min-height:600px}.posts-line{font-size:1.2rem;margin:12px 0}.posts-categories{font-size:.8rem;margin:auto;text-align:center}.posts-category{padding:3px 0;border:#000 2px solid;border-radius:5px}.site-footer{margin-top:50px}.site-footer-item{margin-right:12px}.post-content img{max-width:100%;display:block;margin-right:auto;margin-top:12px}.post-header{margin-bottom:50px}.post-title{font-size:2rem;font-weight:600}.post-tags{display:inline;font-weight:600;padding:2px 5px;margin-right:6px;border:#000 2px solid;border-radius:5px}.post-date{font-weight:800;font-style:italic}.post-author{float:right;font-weight:600}.page-content{min-height:60%}.post-content{margin-bottom:50px}.post-content p{hyphens:auto;line-height:1.8;text-justify:ideographic;margin-bottom:1em}.related-content{border-width:3px;border-style:solid;border-color:#000;padding:0 10px;margin-bottom:50px;margin-top:100px}.related-content li{margin:5px 0}.taxonomy-term{font-size:3rem}.gallery-img{text-align:center}.gallery-img span{text-align:center}.gallery-img-desc{font-size:.8em;font-weight:800}#disqus_thread{position:relative}#disqus_thread:after{content:"";display:block;height:55px;width:100%;position:absolute;bottom:0;background:#fff}@media screen and (max-width:600px){.header-title,.header-subtitle,.header-items{text-align:center}.posts-line{font-size:16px}.markdown-body{font-size:16px}.post-title{font-size:2rem}.post-content p{letter-spacing:.05em}}@media screen and (max-width:48em){.posts-category{display:none}}</style> + + + <style>.container,.container-fluid{margin-right:auto;margin-left:auto}.container-fluid{padding-right:2rem;padding-left:2rem}.row{box-sizing:border-box;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-flex:0;-ms-flex:0 1 auto;flex:initial;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:wrap;flex-wrap:wrap;margin-right:-.5rem;margin-left:-.5rem}.row.reverse{-webkit-box-orient:horizontal;-webkit-box-direction:reverse;-ms-flex-direction:row-reverse;flex-direction:row-reverse}.col.reverse{-webkit-box-orient:vertical;-webkit-box-direction:reverse;-ms-flex-direction:column-reverse;flex-direction:column-reverse}.col-xs,.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9,.col-xs-offset-0,.col-xs-offset-1,.col-xs-offset-10,.col-xs-offset-11,.col-xs-offset-12,.col-xs-offset-2,.col-xs-offset-3,.col-xs-offset-4,.col-xs-offset-5,.col-xs-offset-6,.col-xs-offset-7,.col-xs-offset-8,.col-xs-offset-9{box-sizing:border-box;-webkit-box-flex:0;-ms-flex:0 0 auto;flex:none;padding-right:.5rem;padding-left:.5rem}.col-xs{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-preferred-size:0;flex-basis:0;max-width:100%}.col-xs-1{-ms-flex-preferred-size:8.33333333%;flex-basis:8.33333333%;max-width:8.33333333%}.col-xs-2{-ms-flex-preferred-size:16.66666667%;flex-basis:16.66666667%;max-width:16.66666667%}.col-xs-3{-ms-flex-preferred-size:25%;flex-basis:25%;max-width:25%}.col-xs-4{-ms-flex-preferred-size:33.33333333%;flex-basis:33.33333333%;max-width:33.33333333%}.col-xs-5{-ms-flex-preferred-size:41.66666667%;flex-basis:41.66666667%;max-width:41.66666667%}.col-xs-6{-ms-flex-preferred-size:50%;flex-basis:50%;max-width:50%}.col-xs-7{-ms-flex-preferred-size:58.33333333%;flex-basis:58.33333333%;max-width:58.33333333%}.col-xs-8{-ms-flex-preferred-size:66.66666667%;flex-basis:66.66666667%;max-width:66.66666667%}.col-xs-9{-ms-flex-preferred-size:75%;flex-basis:75%;max-width:75%}.col-xs-10{-ms-flex-preferred-size:83.33333333%;flex-basis:83.33333333%;max-width:83.33333333%}.col-xs-11{-ms-flex-preferred-size:91.66666667%;flex-basis:91.66666667%;max-width:91.66666667%}.col-xs-12{-ms-flex-preferred-size:100%;flex-basis:100%;max-width:100%}.col-xs-offset-0{margin-left:0}.col-xs-offset-1{margin-left:8.33333333%}.col-xs-offset-2{margin-left:16.66666667%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-4{margin-left:33.33333333%}.col-xs-offset-5{margin-left:41.66666667%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-7{margin-left:58.33333333%}.col-xs-offset-8{margin-left:66.66666667%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-10{margin-left:83.33333333%}.col-xs-offset-11{margin-left:91.66666667%}.start-xs{-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;text-align:start}.center-xs{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;text-align:center}.end-xs{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;text-align:end}.top-xs{-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start}.middle-xs{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.bottom-xs{-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end}.around-xs{-ms-flex-pack:distribute;justify-content:space-around}.between-xs{-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.first-xs{-webkit-box-ordinal-group:0;-ms-flex-order:-1;order:-1}.last-xs{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}@media only screen and (min-width:48em){.container{width:49rem}.col-sm,.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-sm-offset-0,.col-sm-offset-1,.col-sm-offset-10,.col-sm-offset-11,.col-sm-offset-12,.col-sm-offset-2,.col-sm-offset-3,.col-sm-offset-4,.col-sm-offset-5,.col-sm-offset-6,.col-sm-offset-7,.col-sm-offset-8,.col-sm-offset-9{box-sizing:border-box;-webkit-box-flex:0;-ms-flex:0 0 auto;flex:none;padding-right:.5rem;padding-left:.5rem}.col-sm{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-preferred-size:0;flex-basis:0;max-width:100%}.col-sm-1{-ms-flex-preferred-size:8.33333333%;flex-basis:8.33333333%;max-width:8.33333333%}.col-sm-2{-ms-flex-preferred-size:16.66666667%;flex-basis:16.66666667%;max-width:16.66666667%}.col-sm-3{-ms-flex-preferred-size:25%;flex-basis:25%;max-width:25%}.col-sm-4{-ms-flex-preferred-size:33.33333333%;flex-basis:33.33333333%;max-width:33.33333333%}.col-sm-5{-ms-flex-preferred-size:41.66666667%;flex-basis:41.66666667%;max-width:41.66666667%}.col-sm-6{-ms-flex-preferred-size:50%;flex-basis:50%;max-width:50%}.col-sm-7{-ms-flex-preferred-size:58.33333333%;flex-basis:58.33333333%;max-width:58.33333333%}.col-sm-8{-ms-flex-preferred-size:66.66666667%;flex-basis:66.66666667%;max-width:66.66666667%}.col-sm-9{-ms-flex-preferred-size:75%;flex-basis:75%;max-width:75%}.col-sm-10{-ms-flex-preferred-size:83.33333333%;flex-basis:83.33333333%;max-width:83.33333333%}.col-sm-11{-ms-flex-preferred-size:91.66666667%;flex-basis:91.66666667%;max-width:91.66666667%}.col-sm-12{-ms-flex-preferred-size:100%;flex-basis:100%;max-width:100%}.col-sm-offset-0{margin-left:0}.col-sm-offset-1{margin-left:8.33333333%}.col-sm-offset-2{margin-left:16.66666667%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-4{margin-left:33.33333333%}.col-sm-offset-5{margin-left:41.66666667%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-7{margin-left:58.33333333%}.col-sm-offset-8{margin-left:66.66666667%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-10{margin-left:83.33333333%}.col-sm-offset-11{margin-left:91.66666667%}.start-sm{-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;text-align:start}.center-sm{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;text-align:center}.end-sm{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;text-align:end}.top-sm{-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start}.middle-sm{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.bottom-sm{-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end}.around-sm{-ms-flex-pack:distribute;justify-content:space-around}.between-sm{-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.first-sm{-webkit-box-ordinal-group:0;-ms-flex-order:-1;order:-1}.last-sm{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}}@media only screen and (min-width:64em){.container{width:65rem}.col-md,.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-md-offset-0,.col-md-offset-1,.col-md-offset-10,.col-md-offset-11,.col-md-offset-12,.col-md-offset-2,.col-md-offset-3,.col-md-offset-4,.col-md-offset-5,.col-md-offset-6,.col-md-offset-7,.col-md-offset-8,.col-md-offset-9{box-sizing:border-box;-webkit-box-flex:0;-ms-flex:0 0 auto;flex:none;padding-right:.5rem;padding-left:.5rem}.col-md{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-preferred-size:0;flex-basis:0;max-width:100%}.col-md-1{-ms-flex-preferred-size:8.33333333%;flex-basis:8.33333333%;max-width:8.33333333%}.col-md-2{-ms-flex-preferred-size:16.66666667%;flex-basis:16.66666667%;max-width:16.66666667%}.col-md-3{-ms-flex-preferred-size:25%;flex-basis:25%;max-width:25%}.col-md-4{-ms-flex-preferred-size:33.33333333%;flex-basis:33.33333333%;max-width:33.33333333%}.col-md-5{-ms-flex-preferred-size:41.66666667%;flex-basis:41.66666667%;max-width:41.66666667%}.col-md-6{-ms-flex-preferred-size:50%;flex-basis:50%;max-width:50%}.col-md-7{-ms-flex-preferred-size:58.33333333%;flex-basis:58.33333333%;max-width:58.33333333%}.col-md-8{-ms-flex-preferred-size:66.66666667%;flex-basis:66.66666667%;max-width:66.66666667%}.col-md-9{-ms-flex-preferred-size:75%;flex-basis:75%;max-width:75%}.col-md-10{-ms-flex-preferred-size:83.33333333%;flex-basis:83.33333333%;max-width:83.33333333%}.col-md-11{-ms-flex-preferred-size:91.66666667%;flex-basis:91.66666667%;max-width:91.66666667%}.col-md-12{-ms-flex-preferred-size:100%;flex-basis:100%;max-width:100%}.col-md-offset-0{margin-left:0}.col-md-offset-1{margin-left:8.33333333%}.col-md-offset-2{margin-left:16.66666667%}.col-md-offset-3{margin-left:25%}.col-md-offset-4{margin-left:33.33333333%}.col-md-offset-5{margin-left:41.66666667%}.col-md-offset-6{margin-left:50%}.col-md-offset-7{margin-left:58.33333333%}.col-md-offset-8{margin-left:66.66666667%}.col-md-offset-9{margin-left:75%}.col-md-offset-10{margin-left:83.33333333%}.col-md-offset-11{margin-left:91.66666667%}.start-md{-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;text-align:start}.center-md{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;text-align:center}.end-md{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;text-align:end}.top-md{-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start}.middle-md{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.bottom-md{-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end}.around-md{-ms-flex-pack:distribute;justify-content:space-around}.between-md{-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.first-md{-webkit-box-ordinal-group:0;-ms-flex-order:-1;order:-1}.last-md{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}}@media only screen and (min-width:75em){.container{width:76rem}.col-lg,.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-lg-offset-0,.col-lg-offset-1,.col-lg-offset-10,.col-lg-offset-11,.col-lg-offset-12,.col-lg-offset-2,.col-lg-offset-3,.col-lg-offset-4,.col-lg-offset-5,.col-lg-offset-6,.col-lg-offset-7,.col-lg-offset-8,.col-lg-offset-9{box-sizing:border-box;-webkit-box-flex:0;-ms-flex:0 0 auto;flex:none;padding-right:.5rem;padding-left:.5rem}.col-lg{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-preferred-size:0;flex-basis:0;max-width:100%}.col-lg-1{-ms-flex-preferred-size:8.33333333%;flex-basis:8.33333333%;max-width:8.33333333%}.col-lg-2{-ms-flex-preferred-size:16.66666667%;flex-basis:16.66666667%;max-width:16.66666667%}.col-lg-3{-ms-flex-preferred-size:25%;flex-basis:25%;max-width:25%}.col-lg-4{-ms-flex-preferred-size:33.33333333%;flex-basis:33.33333333%;max-width:33.33333333%}.col-lg-5{-ms-flex-preferred-size:41.66666667%;flex-basis:41.66666667%;max-width:41.66666667%}.col-lg-6{-ms-flex-preferred-size:50%;flex-basis:50%;max-width:50%}.col-lg-7{-ms-flex-preferred-size:58.33333333%;flex-basis:58.33333333%;max-width:58.33333333%}.col-lg-8{-ms-flex-preferred-size:66.66666667%;flex-basis:66.66666667%;max-width:66.66666667%}.col-lg-9{-ms-flex-preferred-size:75%;flex-basis:75%;max-width:75%}.col-lg-10{-ms-flex-preferred-size:83.33333333%;flex-basis:83.33333333%;max-width:83.33333333%}.col-lg-11{-ms-flex-preferred-size:91.66666667%;flex-basis:91.66666667%;max-width:91.66666667%}.col-lg-12{-ms-flex-preferred-size:100%;flex-basis:100%;max-width:100%}.col-lg-offset-0{margin-left:0}.col-lg-offset-1{margin-left:8.33333333%}.col-lg-offset-2{margin-left:16.66666667%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-4{margin-left:33.33333333%}.col-lg-offset-5{margin-left:41.66666667%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-7{margin-left:58.33333333%}.col-lg-offset-8{margin-left:66.66666667%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-10{margin-left:83.33333333%}.col-lg-offset-11{margin-left:91.66666667%}.start-lg{-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;text-align:start}.center-lg{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;text-align:center}.end-lg{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;text-align:end}.top-lg{-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start}.middle-lg{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.bottom-lg{-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end}.around-lg{-ms-flex-pack:distribute;justify-content:space-around}.between-lg{-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.first-lg{-webkit-box-ordinal-group:0;-ms-flex-order:-1;order:-1}.last-lg{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}}</style> + + + + + <link href="/index.xml" rel="alternate" type="application/rss+xml" + title="blog | garhve's hub"> + + <link rel="preconnect" href="https://fonts.gstatic.com"> + <link href="https://fonts.googleapis.com/css?family=Bree+Serif|Bungee+Shade" rel="stylesheet"> + + + +</head> + + +<body> + <article class="post English" id="article"> + <div class="row"> + <div class="col-xs-12"> + <div class="site-header"> + +<header> + <div class="header-title"> + <a href="/" + >Garhve</a + > + </div> + <div class="header-subtitle"></div> +</header> +<div class="row end-md center-xs header-items"> +</div> +<div class="row end-xs"> + + <div class="lang-switch col-xs-3 col-xs-offset-9"> + <a href="/cn/">Chinese</a> + </div> + +</div> +<div class="header-line"></div> + + </div> + <header class="post-header"> + <h1 class="post-title">Escape Sequences</h1> + + <div class="row post-desc"> + <div class="col-xs-6"> + + <time class="post-date" datetime="2022-09-12 09:02:06 CST"> + 12 Sep 2022 + </time> + + </div> + <div class="col-xs-6"> + + <div class="post-author"> + <a target="_blank" href="https://garhve.com">@garhve</a> + </div> + + </div> + </div> + + </header> + + <div class="post-content markdown-body"> + + <blockquote> +<p>copied from <a href="https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797">github</a> in case one day it disappears</p> +<p>more information could visit <a href="https://vt100.net/docs/vt100-ug/chapter3.html">vt100 User Guide</a></p> +</blockquote> +<h1 id="ansi-escape-sequences">ANSI Escape Sequences</h1> +<p>Standard escape codes are prefixed with <code>Escape</code>:</p> +<ul> +<li>Ctrl-Key: <code>^[</code></li> +<li>Octal: <code>\033</code></li> +<li>Unicode: <code>\u001b</code></li> +<li>Hexadecimal: <code>\x1B</code></li> +<li>Decimal: <code>27</code></li> +</ul> +<p>Followed by the command, somtimes delimited by opening square bracket (<code>[</code>), known as a Control Sequence Introducer (CSI), optionally followed by arguments and the command itself.</p> +<p>Arguments are delimeted by semi colon (<code>;</code>).</p> +<p>For example:</p> +<div class="highlight"><pre tabindex="0" style="background-color:#fff;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"><code class="language-sh" data-lang="sh"><span style="display:flex;"><span><span style="font-weight:bold;font-style:italic">\x</span>1b[1;31m <span style="font-style:italic"># Set style to bold, red foreground.</span> +</span></span></code></pre></div><h2 id="sequences">Sequences</h2> +<ul> +<li><code>ESC</code> - sequence starting with <code>ESC</code> (<code>\x1B</code>)</li> +<li><code>CSI</code> - Control Sequence Introducer: sequence starting with <code>ESC [</code> or CSI (<code>\x9B</code>)</li> +<li><code>DCS</code> - Device Control String: sequence starting with <code>ESC P</code> or DCS (<code>\x90</code>)</li> +<li><code>OSC</code> - Operating System Command: sequence starting with <code>ESC ]</code> or OSC (<code>\x9D</code>)</li> +</ul> +<p>Any whitespaces between sequences and arguments should be ignored. They are present for improved readability.</p> +<h2 id="general-ascii-codes">General ASCII Codes</h2> +<table> +<thead> +<tr> +<th>Name</th> +<th>decimal</th> +<th>octal</th> +<th>hex</th> +<th>C-escape</th> +<th>Ctrl-Key</th> +<th>Description</th> +</tr> +</thead> +<tbody> +<tr> +<td><code>BEL</code></td> +<td>7</td> +<td>007</td> +<td>0x07</td> +<td><code>\a</code></td> +<td><code>^G</code></td> +<td>Terminal bell</td> +</tr> +<tr> +<td><code>BS</code></td> +<td>8</td> +<td>010</td> +<td>0x08</td> +<td><code>\b</code></td> +<td><code>^H</code></td> +<td>Backspace</td> +</tr> +<tr> +<td><code>HT</code></td> +<td>9</td> +<td>011</td> +<td>0x09</td> +<td><code>\t</code></td> +<td><code>^I</code></td> +<td>Horizontal TAB</td> +</tr> +<tr> +<td><code>LF</code></td> +<td>10</td> +<td>012</td> +<td>0x0A</td> +<td><code>\n</code></td> +<td><code>^J</code></td> +<td>Linefeed (newline)</td> +</tr> +<tr> +<td><code>VT</code></td> +<td>11</td> +<td>013</td> +<td>0x0B</td> +<td><code>\v</code></td> +<td><code>^K</code></td> +<td>Vertical TAB</td> +</tr> +<tr> +<td><code>FF</code></td> +<td>12</td> +<td>014</td> +<td>0x0C</td> +<td><code>\f</code></td> +<td><code>^L</code></td> +<td>Formfeed (also: New page<code>NP</code>)</td> +</tr> +<tr> +<td><code>CR</code></td> +<td>13</td> +<td>015</td> +<td>0x0D</td> +<td><code>\r</code></td> +<td><code>^M</code></td> +<td>Carriage return</td> +</tr> +<tr> +<td><code>ESC</code></td> +<td>27</td> +<td>033</td> +<td>0x1B</td> +<td><code>\e</code><a href="#escape">*</a></td> +<td><code>^[</code></td> +<td>Escape character</td> +</tr> +<tr> +<td><code>DEL</code></td> +<td>127</td> +<td>177</td> +<td>0x7F</td> +<td><code><none></code></td> +<td><code><none></code></td> +<td>Delete character</td> +</tr> +</tbody> +</table> +<div id="escape"></div> +<blockquote> +<p><strong>Note:</strong> Some control escape sequences, like <code>\e</code> for <code>ESC</code>, are not guaranteed to work in all languages and compilers. It is recommended to use the decimal, octal or hex representation as escape code.</p> +</blockquote> +<blockquote> +<p><strong>Note:</strong> The <strong>Ctrl-Key</strong> representation is simply associating the non-printable characters from ASCII code 1 with the printable (letter) characters from ASCII code 65 (“A”). ASCII code 1 would be <code>^A</code> (Ctrl-A), while ASCII code 7 (BEL) would be <code>^G</code> (Ctrl-G). This is a common representation (and input method) and historically comes from one of the VT series of terminals.</p> +</blockquote> +<h2 id="cursor-controls">Cursor Controls</h2> +<table> +<thead> +<tr> +<th style="text-align:left">ESC Code Sequence</th> +<th style="text-align:left">Description</th> +</tr> +</thead> +<tbody> +<tr> +<td style="text-align:left"><code>ESC[H</code></td> +<td style="text-align:left">moves cursor to home position (0, 0)</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[{line};{column}H</code> <br> <code>ESC[{line};{column}f</code></td> +<td style="text-align:left">moves cursor to line #, column #</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[#A</code></td> +<td style="text-align:left">moves cursor up # lines</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[#B</code></td> +<td style="text-align:left">moves cursor down # lines</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[#C</code></td> +<td style="text-align:left">moves cursor right # columns</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[#D</code></td> +<td style="text-align:left">moves cursor left # columns</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[#E</code></td> +<td style="text-align:left">moves cursor to beginning of next line, # lines down</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[#F</code></td> +<td style="text-align:left">moves cursor to beginning of previous line, # lines up</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[#G</code></td> +<td style="text-align:left">moves cursor to column #</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[6n</code></td> +<td style="text-align:left">request cursor position (reports as<code>ESC[#;#R</code>)</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC M</code></td> +<td style="text-align:left">moves cursor one line up, scrolling if needed</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC 7</code></td> +<td style="text-align:left">save cursor position (DEC)</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC 8</code></td> +<td style="text-align:left">restores the cursor to the last saved position (DEC)</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[s</code></td> +<td style="text-align:left">save cursor position (SCO)</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[u</code></td> +<td style="text-align:left">restores the cursor to the last saved position (SCO)</td> +</tr> +</tbody> +</table> +<blockquote> +<p><strong>Note:</strong> Some sequences, like saving and restoring cursors, are private sequences and are not standardized. While some terminal emulators (i.e. xterm and derived) support both SCO and DEC sequences, they are likely to have different functionality. It is therefore recommended to use DEC sequences.</p> +</blockquote> +<h2 id="erase-functions">Erase Functions</h2> +<table> +<thead> +<tr> +<th style="text-align:left">ESC Code Sequence</th> +<th style="text-align:left">Description</th> +</tr> +</thead> +<tbody> +<tr> +<td style="text-align:left"><code>ESC[J</code></td> +<td style="text-align:left">erase in display (same as ESC[0J)</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[0J</code></td> +<td style="text-align:left">erase from cursor until end of screen</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[1J</code></td> +<td style="text-align:left">erase from cursor to beginning of screen</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[2J</code></td> +<td style="text-align:left">erase entire screen</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[3J</code></td> +<td style="text-align:left">erase saved lines</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[K</code></td> +<td style="text-align:left">erase in line (same as ESC[0K)</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[0K</code></td> +<td style="text-align:left">erase from cursor to end of line</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[1K</code></td> +<td style="text-align:left">erase start of line to the cursor</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[2K</code></td> +<td style="text-align:left">erase the entire line</td> +</tr> +</tbody> +</table> +<blockquote> +<p>Note: Erasing the line won’t move the cursor, meaning that the cursor will stay at the last position it was at before the line was erased. You can use <code>\r</code> after erasing the line, to return the cursor to the start of the current line.</p> +</blockquote> +<h2 id="colors--graphics-mode">Colors / Graphics Mode</h2> +<table> +<thead> +<tr> +<th style="text-align:left">ESC Code Sequence</th> +<th style="text-align:left">Reset Sequence</th> +<th style="text-align:left">Description</th> +</tr> +</thead> +<tbody> +<tr> +<td style="text-align:left"><code>ESC[1;34;{...}m</code></td> +<td style="text-align:left"></td> +<td style="text-align:left">Set graphics modes for cell, separated by semicolon (<code>;</code>).</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[0m</code></td> +<td style="text-align:left"></td> +<td style="text-align:left">reset all modes (styles and colors)</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[1m</code></td> +<td style="text-align:left"><code>ESC[22m</code></td> +<td style="text-align:left">set bold mode.</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[2m</code></td> +<td style="text-align:left"><code>ESC[22m</code></td> +<td style="text-align:left">set dim/faint mode.</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[3m</code></td> +<td style="text-align:left"><code>ESC[23m</code></td> +<td style="text-align:left">set italic mode.</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[4m</code></td> +<td style="text-align:left"><code>ESC[24m</code></td> +<td style="text-align:left">set underline mode.</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[5m</code></td> +<td style="text-align:left"><code>ESC[25m</code></td> +<td style="text-align:left">set blinking mode</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[7m</code></td> +<td style="text-align:left"><code>ESC[27m</code></td> +<td style="text-align:left">set inverse/reverse mode</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[8m</code></td> +<td style="text-align:left"><code>ESC[28m</code></td> +<td style="text-align:left">set hidden/invisible mode</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[9m</code></td> +<td style="text-align:left"><code>ESC[29m</code></td> +<td style="text-align:left">set strikethrough mode.</td> +</tr> +</tbody> +</table> +<blockquote> +<p><strong>Note:</strong> Some terminals may not support some of the graphic mode sequences listed above.</p> +</blockquote> +<blockquote> +<p><strong>Note:</strong> Both dim and bold modes are reset with the <code>ESC[22m</code> sequence. The <code>ESC[21m</code> sequence is a non-specified sequence for double underline mode and only work in some terminals and is reset with <code>ESC[24m</code>.</p> +</blockquote> +<h3 id="color-codes">Color codes</h3> +<p>Most terminals support 8 and 16 colors, as well as 256 (8-bit) colors. These colors are set by the user, but have commonly defined meanings.</p> +<h4 id="8-16-colors">8-16 Colors</h4> +<table> +<thead> +<tr> +<th style="text-align:left">Color Name</th> +<th style="text-align:left">Foreground Color Code</th> +<th style="text-align:left">Background Color Code</th> +</tr> +</thead> +<tbody> +<tr> +<td style="text-align:left">Black</td> +<td style="text-align:left"><code>30</code></td> +<td style="text-align:left"><code>40</code></td> +</tr> +<tr> +<td style="text-align:left">Red</td> +<td style="text-align:left"><code>31</code></td> +<td style="text-align:left"><code>41</code></td> +</tr> +<tr> +<td style="text-align:left">Green</td> +<td style="text-align:left"><code>32</code></td> +<td style="text-align:left"><code>42</code></td> +</tr> +<tr> +<td style="text-align:left">Yellow</td> +<td style="text-align:left"><code>33</code></td> +<td style="text-align:left"><code>43</code></td> +</tr> +<tr> +<td style="text-align:left">Blue</td> +<td style="text-align:left"><code>34</code></td> +<td style="text-align:left"><code>44</code></td> +</tr> +<tr> +<td style="text-align:left">Magenta</td> +<td style="text-align:left"><code>35</code></td> +<td style="text-align:left"><code>45</code></td> +</tr> +<tr> +<td style="text-align:left">Cyan</td> +<td style="text-align:left"><code>36</code></td> +<td style="text-align:left"><code>46</code></td> +</tr> +<tr> +<td style="text-align:left">White</td> +<td style="text-align:left"><code>37</code></td> +<td style="text-align:left"><code>47</code></td> +</tr> +<tr> +<td style="text-align:left">Default</td> +<td style="text-align:left"><code>39</code></td> +<td style="text-align:left"><code>49</code></td> +</tr> +<tr> +<td style="text-align:left">Reset</td> +<td style="text-align:left"><code>0</code></td> +<td style="text-align:left"><code>0</code></td> +</tr> +</tbody> +</table> +<blockquote> +<p><strong>Note:</strong> the <em>Reset</em> color is the reset code that resets <em>all</em> colors and text effects, Use <em>Default</em> color to reset colors only.</p> +</blockquote> +<p>Most terminals, apart from the basic set of 8 colors, also support the “bright” or “bold” colors. These have their own set of codes, mirroring the normal colors, but with an additional <code>;1</code> in their codes:</p> +<div class="highlight"><pre tabindex="0" style="background-color:#fff;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"><code class="language-sh" data-lang="sh"><span style="display:flex;"><span><span style="font-style:italic"># Set style to bold, red foreground.</span> +</span></span><span style="display:flex;"><span><span style="font-weight:bold;font-style:italic">\x</span>1b[1;31mHello +</span></span><span style="display:flex;"><span><span style="font-style:italic"># Set style to dimmed white foreground with red background.</span> +</span></span><span style="display:flex;"><span><span style="font-weight:bold;font-style:italic">\x</span>1b[2;37;41mWorld +</span></span></code></pre></div><p>Terminals that support the <a href="https://sites.ualberta.ca/dept/chemeng/AIX-43/share/man/info/C/a_doc_lib/cmds/aixcmds1/aixterm.htm">aixterm specification</a> provides bright versions of the ISO colors, without the need to use the bold modifier:</p> +<table> +<thead> +<tr> +<th style="text-align:left">Color Name</th> +<th style="text-align:left">Foreground Color Code</th> +<th style="text-align:left">Background Color Code</th> +</tr> +</thead> +<tbody> +<tr> +<td style="text-align:left">Bright Black</td> +<td style="text-align:left"><code>90</code></td> +<td style="text-align:left"><code>100</code></td> +</tr> +<tr> +<td style="text-align:left">Bright Red</td> +<td style="text-align:left"><code>91</code></td> +<td style="text-align:left"><code>101</code></td> +</tr> +<tr> +<td style="text-align:left">Bright Green</td> +<td style="text-align:left"><code>92</code></td> +<td style="text-align:left"><code>102</code></td> +</tr> +<tr> +<td style="text-align:left">Bright Yellow</td> +<td style="text-align:left"><code>93</code></td> +<td style="text-align:left"><code>103</code></td> +</tr> +<tr> +<td style="text-align:left">Bright Blue</td> +<td style="text-align:left"><code>94</code></td> +<td style="text-align:left"><code>104</code></td> +</tr> +<tr> +<td style="text-align:left">Bright Magenta</td> +<td style="text-align:left"><code>95</code></td> +<td style="text-align:left"><code>105</code></td> +</tr> +<tr> +<td style="text-align:left">Bright Cyan</td> +<td style="text-align:left"><code>96</code></td> +<td style="text-align:left"><code>106</code></td> +</tr> +<tr> +<td style="text-align:left">Bright White</td> +<td style="text-align:left"><code>97</code></td> +<td style="text-align:left"><code>107</code></td> +</tr> +</tbody> +</table> +<h4 id="256-colors">256 Colors</h4> +<p>The following escape codes tells the terminal to use the given color ID:</p> +<table> +<thead> +<tr> +<th style="text-align:left">ESC Code Sequence</th> +<th style="text-align:left">Description</th> +</tr> +</thead> +<tbody> +<tr> +<td style="text-align:left"><code>ESC[38;5;{ID}m</code></td> +<td style="text-align:left">Set foreground color.</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[48;5;{ID}m</code></td> +<td style="text-align:left">Set background color.</td> +</tr> +</tbody> +</table> +<p>Where <code>{ID}</code> should be replaced with the color index from 0 to 255 of the following color table:</p> +<p><img src="https://user-images.githubusercontent.com/995050/47952855-ecb12480-df75-11e8-89d4-ac26c50e80b9.png" alt="256 Color table"></p> +<p>The table starts with the original 16 colors (0-15).</p> +<p>The proceeding 216 colors (16-231) or formed by a 3bpc RGB value offset by 16, packed into a single value.</p> +<p>The final 24 colors (232-255) are grayscale starting from a shade slighly lighter than black, ranging up to shade slightly darker than white.</p> +<p>Some emulators interpret these steps as linear increments (<code>256 / 24</code>) on all three channels, although some emulators may explicitly define these values.</p> +<h4 id="rgb-colors">RGB Colors</h4> +<p>More modern terminals supports <a href="https://en.wikipedia.org/wiki/Color_depth#True_color_.2824-bit.29">Truecolor</a> (24-bit RGB), which allows you to set foreground and background colors using RGB.</p> +<p>These escape sequences are usually not well documented.</p> +<table> +<thead> +<tr> +<th style="text-align:left">ESC Code Sequence</th> +<th style="text-align:left">Description</th> +</tr> +</thead> +<tbody> +<tr> +<td style="text-align:left"><code>ESC[38;2;{r};{g};{b}m</code></td> +<td style="text-align:left">Set foreground color as RGB.</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[48;2;{r};{g};{b}m</code></td> +<td style="text-align:left">Set background color as RGB.</td> +</tr> +</tbody> +</table> +<blockquote> +<p>Note that <code>;38</code> and <code>;48</code> corresponds to the 16 color sequence and is interpreted by the terminal to set the foreground and background color respectively. Where as <code>;2</code> and <code>;5</code> sets the color format.</p> +</blockquote> +<h2 id="screen-modes">Screen Modes</h2> +<h3 id="set-mode">Set Mode</h3> +<table> +<thead> +<tr> +<th style="text-align:left">ESC Code Sequence</th> +<th style="text-align:left">Description</th> +</tr> +</thead> +<tbody> +<tr> +<td style="text-align:left"><code>ESC[={value}h</code></td> +<td style="text-align:left">Changes the screen width or type to the mode specified by value.</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[=0h</code></td> +<td style="text-align:left">40 x 25 monochrome (text)</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[=1h</code></td> +<td style="text-align:left">40 x 25 color (text)</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[=2h</code></td> +<td style="text-align:left">80 x 25 monochrome (text)</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[=3h</code></td> +<td style="text-align:left">80 x 25 color (text)</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[=4h</code></td> +<td style="text-align:left">320 x 200 4-color (graphics)</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[=5h</code></td> +<td style="text-align:left">320 x 200 monochrome (graphics)</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[=6h</code></td> +<td style="text-align:left">640 x 200 monochrome (graphics)</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[=7h</code></td> +<td style="text-align:left">Enables line wrapping</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[=13h</code></td> +<td style="text-align:left">320 x 200 color (graphics)</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[=14h</code></td> +<td style="text-align:left">640 x 200 color (16-color graphics)</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[=15h</code></td> +<td style="text-align:left">640 x 350 monochrome (2-color graphics)</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[=16h</code></td> +<td style="text-align:left">640 x 350 color (16-color graphics)</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[=17h</code></td> +<td style="text-align:left">640 x 480 monochrome (2-color graphics)</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[=18h</code></td> +<td style="text-align:left">640 x 480 color (16-color graphics)</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[=19h</code></td> +<td style="text-align:left">320 x 200 color (256-color graphics)</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[={value}l</code></td> +<td style="text-align:left">Resets the mode by using the same values that Set Mode uses, except for 7, which disables line wrapping. The last character in this escape sequence is a lowercase L.</td> +</tr> +</tbody> +</table> +<h3 id="common-private-modes">Common Private Modes</h3> +<p>These are some examples of private modes, which are not defined by the specification, but are implemented in most terminals.</p> +<table> +<thead> +<tr> +<th style="text-align:left">ESC Code Sequence</th> +<th style="text-align:left">Description</th> +</tr> +</thead> +<tbody> +<tr> +<td style="text-align:left"><code>ESC[?25l</code></td> +<td style="text-align:left">make cursor invisible</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[?25h</code></td> +<td style="text-align:left">make cursor visible</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[?47l</code></td> +<td style="text-align:left">restore screen</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[?47h</code></td> +<td style="text-align:left">save screen</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[?1049h</code></td> +<td style="text-align:left">enables the alternative buffer</td> +</tr> +<tr> +<td style="text-align:left"><code>ESC[?1049l</code></td> +<td style="text-align:left">disables the alternative buffer</td> +</tr> +</tbody> +</table> +<p>Refer to the <a href="https://invisible-island.net/xterm/ctlseqs/ctlseqs.html">XTerm Control Sequences</a> for a more in-depth list of private modes defined by XTerm.</p> +<blockquote> +<p>Note: While these modes may be supported by the most terminals, some may not work in multiplexers like tmux.</p> +</blockquote> +<h3 id="keyboard-strings">Keyboard Strings</h3> +<div class="highlight"><pre tabindex="0" style="background-color:#fff;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"><code class="language-sh" data-lang="sh"><span style="display:flex;"><span>ESC[{code};{string};{...}p +</span></span></code></pre></div><p>Redefines a keyboard key to a specified string.</p> +<p>The parameters for this escape sequence are defined as follows:</p> +<ul> +<li><code>code</code> is one or more of the values listed in the following table. These values represent keyboard keys and key combinations. When using these values in a command, you must type the semicolons shown in this table in addition to the semicolons required by the escape sequence. The codes in parentheses are not available on some keyboards. <code>ANSI.SYS</code> will not interpret the codes in parentheses for those keyboards unless you specify the <code>/X</code> switch in the <code>DEVICE</code> command for <code>ANSI.SYS</code>.</li> +<li><code>string</code> is either the ASCII code for a single character or a string contained in quotation marks. For example, both 65 and “A” can be used to represent an uppercase A.</li> +</ul> +<blockquote> +<p><strong>IMPORTANT:</strong> Some of the values in the following table are not valid for all computers. Check your computer’s documentation for values that are different.</p> +</blockquote> +<h4 id="list-of-keyboard-strings">List of keyboard strings</h4> +<table> +<thead> +<tr> +<th>Key</th> +<th>Code</th> +<th>SHIFT+code</th> +<th>CTRL+code</th> +<th>ALT+code</th> +</tr> +</thead> +<tbody> +<tr> +<td>F1</td> +<td>0;59</td> +<td>0;84</td> +<td>0;94</td> +<td>0;104</td> +</tr> +<tr> +<td>F2</td> +<td>0;60</td> +<td>0;85</td> +<td>0;95</td> +<td>0;105</td> +</tr> +<tr> +<td>F3</td> +<td>0;61</td> +<td>0;86</td> +<td>0;96</td> +<td>0;106</td> +</tr> +<tr> +<td>F4</td> +<td>0;62</td> +<td>0;87</td> +<td>0;97</td> +<td>0;107</td> +</tr> +<tr> +<td>F5</td> +<td>0;63</td> +<td>0;88</td> +<td>0;98</td> +<td>0;108</td> +</tr> +<tr> +<td>F6</td> +<td>0;64</td> +<td>0;89</td> +<td>0;99</td> +<td>0;109</td> +</tr> +<tr> +<td>F7</td> +<td>0;65</td> +<td>0;90</td> +<td>0;100</td> +<td>0;110</td> +</tr> +<tr> +<td>F8</td> +<td>0;66</td> +<td>0;91</td> +<td>0;101</td> +<td>0;111</td> +</tr> +<tr> +<td>F9</td> +<td>0;67</td> +<td>0;92</td> +<td>0;102</td> +<td>0;112</td> +</tr> +<tr> +<td>F10</td> +<td>0;68</td> +<td>0;93</td> +<td>0;103</td> +<td>0;113</td> +</tr> +<tr> +<td>F11</td> +<td>0;133</td> +<td>0;135</td> +<td>0;137</td> +<td>0;139</td> +</tr> +<tr> +<td>F12</td> +<td>0;134</td> +<td>0;136</td> +<td>0;138</td> +<td>0;140</td> +</tr> +<tr> +<td>HOME (num keypad)</td> +<td>0;71</td> +<td>55</td> +<td>0;119</td> +<td>--</td> +</tr> +<tr> +<td>UP ARROW (num keypad)</td> +<td>0;72</td> +<td>56</td> +<td>(0;141)</td> +<td>--</td> +</tr> +<tr> +<td>PAGE UP (num keypad)</td> +<td>0;73</td> +<td>57</td> +<td>0;132</td> +<td>--</td> +</tr> +<tr> +<td>LEFT ARROW (num keypad)</td> +<td>0;75</td> +<td>52</td> +<td>0;115</td> +<td>--</td> +</tr> +<tr> +<td>RIGHT ARROW (num keypad)</td> +<td>0;77</td> +<td>54</td> +<td>0;116</td> +<td>--</td> +</tr> +<tr> +<td>END (num keypad)</td> +<td>0;79</td> +<td>49</td> +<td>0;117</td> +<td>--</td> +</tr> +<tr> +<td>DOWN ARROW (num keypad)</td> +<td>0;80</td> +<td>50</td> +<td>(0;145)</td> +<td>--</td> +</tr> +<tr> +<td>PAGE DOWN (num keypad)</td> +<td>0;81</td> +<td>51</td> +<td>0;118</td> +<td>--</td> +</tr> +<tr> +<td>INSERT (num keypad)</td> +<td>0;82</td> +<td>48</td> +<td>(0;146)</td> +<td>--</td> +</tr> +<tr> +<td>DELETE (num keypad)</td> +<td>0;83</td> +<td>46</td> +<td>(0;147)</td> +<td>--</td> +</tr> +<tr> +<td>HOME</td> +<td>(224;71)</td> +<td>(224;71)</td> +<td>(224;119)</td> +<td>(224;151)</td> +</tr> +<tr> +<td>UP ARROW</td> +<td>(224;72)</td> +<td>(224;72)</td> +<td>(224;141)</td> +<td>(224;152)</td> +</tr> +<tr> +<td>PAGE UP</td> +<td>(224;73)</td> +<td>(224;73)</td> +<td>(224;132)</td> +<td>(224;153)</td> +</tr> +<tr> +<td>LEFT ARROW</td> +<td>(224;75)</td> +<td>(224;75)</td> +<td>(224;115)</td> +<td>(224;155)</td> +</tr> +<tr> +<td>RIGHT ARROW</td> +<td>(224;77)</td> +<td>(224;77)</td> +<td>(224;116)</td> +<td>(224;157)</td> +</tr> +<tr> +<td>END</td> +<td>(224;79)</td> +<td>(224;79)</td> +<td>(224;117)</td> +<td>(224;159)</td> +</tr> +<tr> +<td>DOWN ARROW</td> +<td>(224;80)</td> +<td>(224;80)</td> +<td>(224;145)</td> +<td>(224;154)</td> +</tr> +<tr> +<td>PAGE DOWN</td> +<td>(224;81)</td> +<td>(224;81)</td> +<td>(224;118)</td> +<td>(224;161)</td> +</tr> +<tr> +<td>INSERT</td> +<td>(224;82)</td> +<td>(224;82)</td> +<td>(224;146)</td> +<td>(224;162)</td> +</tr> +<tr> +<td>DELETE</td> +<td>(224;83)</td> +<td>(224;83)</td> +<td>(224;147)</td> +<td>(224;163)</td> +</tr> +<tr> +<td>PRINT SCREEN</td> +<td>--</td> +<td>--</td> +<td>0;114</td> +<td>--</td> +</tr> +<tr> +<td>PAUSE/BREAK</td> +<td>--</td> +<td>--</td> +<td>0;0</td> +<td>--</td> +</tr> +<tr> +<td>BACKSPACE</td> +<td>8</td> +<td>8</td> +<td>127</td> +<td>(0)</td> +</tr> +<tr> +<td>ENTER</td> +<td>13</td> +<td>--</td> +<td>10</td> +<td>(0</td> +</tr> +<tr> +<td>TAB</td> +<td>9</td> +<td>0;15</td> +<td>(0;148)</td> +<td>(0;165)</td> +</tr> +<tr> +<td>NULL</td> +<td>0;3</td> +<td>--</td> +<td>--</td> +<td>--</td> +</tr> +<tr> +<td>A</td> +<td>97</td> +<td>65</td> +<td>1</td> +<td>0;30</td> +</tr> +<tr> +<td>B</td> +<td>98</td> +<td>66</td> +<td>2</td> +<td>0;48</td> +</tr> +<tr> +<td>C</td> +<td>99</td> +<td>66</td> +<td>3</td> +<td>0;46</td> +</tr> +<tr> +<td>D</td> +<td>100</td> +<td>68</td> +<td>4</td> +<td>0;32</td> +</tr> +<tr> +<td>E</td> +<td>101</td> +<td>69</td> +<td>5</td> +<td>0;18</td> +</tr> +<tr> +<td>F</td> +<td>102</td> +<td>70</td> +<td>6</td> +<td>0;33</td> +</tr> +<tr> +<td>G</td> +<td>103</td> +<td>71</td> +<td>7</td> +<td>0;34</td> +</tr> +<tr> +<td>H</td> +<td>104</td> +<td>72</td> +<td>8</td> +<td>0;35</td> +</tr> +<tr> +<td>I</td> +<td>105</td> +<td>73</td> +<td>9</td> +<td>0;23</td> +</tr> +<tr> +<td>J</td> +<td>106</td> +<td>74</td> +<td>10</td> +<td>0;36</td> +</tr> +<tr> +<td>K</td> +<td>107</td> +<td>75</td> +<td>11</td> +<td>0;37</td> +</tr> +<tr> +<td>L</td> +<td>108</td> +<td>76</td> +<td>12</td> +<td>0;38</td> +</tr> +<tr> +<td>M</td> +<td>109</td> +<td>77</td> +<td>13</td> +<td>0;50</td> +</tr> +<tr> +<td>N</td> +<td>110</td> +<td>78</td> +<td>14</td> +<td>0;49</td> +</tr> +<tr> +<td>O</td> +<td>111</td> +<td>79</td> +<td>15</td> +<td>0;24</td> +</tr> +<tr> +<td>P</td> +<td>112</td> +<td>80</td> +<td>16</td> +<td>0;25</td> +</tr> +<tr> +<td>Q</td> +<td>113</td> +<td>81</td> +<td>17</td> +<td>0;16</td> +</tr> +<tr> +<td>R</td> +<td>114</td> +<td>82</td> +<td>18</td> +<td>0;19</td> +</tr> +<tr> +<td>S</td> +<td>115</td> +<td>83</td> +<td>19</td> +<td>0;31</td> +</tr> +<tr> +<td>T</td> +<td>116</td> +<td>84</td> +<td>20</td> +<td>0;20</td> +</tr> +<tr> +<td>U</td> +<td>117</td> +<td>85</td> +<td>21</td> +<td>0;22</td> +</tr> +<tr> +<td>V</td> +<td>118</td> +<td>86</td> +<td>22</td> +<td>0;47</td> +</tr> +<tr> +<td>W</td> +<td>119</td> +<td>87</td> +<td>23</td> +<td>0;17</td> +</tr> +<tr> +<td>X</td> +<td>120</td> +<td>88</td> +<td>24</td> +<td>0;45</td> +</tr> +<tr> +<td>Y</td> +<td>121</td> +<td>89</td> +<td>25</td> +<td>0;21</td> +</tr> +<tr> +<td>Z</td> +<td>122</td> +<td>90</td> +<td>26</td> +<td>0;44</td> +</tr> +<tr> +<td>1</td> +<td>49</td> +<td>33</td> +<td>--</td> +<td>0;120</td> +</tr> +<tr> +<td>2</td> +<td>50</td> +<td>64</td> +<td>0</td> +<td>0;121</td> +</tr> +<tr> +<td>3</td> +<td>51</td> +<td>35</td> +<td>--</td> +<td>0;122</td> +</tr> +<tr> +<td>4</td> +<td>52</td> +<td>36</td> +<td>--</td> +<td>0;123</td> +</tr> +<tr> +<td>5</td> +<td>53</td> +<td>37</td> +<td>--</td> +<td>0;124</td> +</tr> +<tr> +<td>6</td> +<td>54</td> +<td>94</td> +<td>30</td> +<td>0;125</td> +</tr> +<tr> +<td>7</td> +<td>55</td> +<td>38</td> +<td>--</td> +<td>0;126</td> +</tr> +<tr> +<td>8</td> +<td>56</td> +<td>42</td> +<td>--</td> +<td>0;126</td> +</tr> +<tr> +<td>9</td> +<td>57</td> +<td>40</td> +<td>--</td> +<td>0;127</td> +</tr> +<tr> +<td>0</td> +<td>48</td> +<td>41</td> +<td>--</td> +<td>0;129</td> +</tr> +<tr> +<td>-</td> +<td>45</td> +<td>95</td> +<td>31</td> +<td>0;130</td> +</tr> +<tr> +<td>=</td> +<td>61</td> +<td>43</td> +<td>-–</td> +<td>0;131</td> +</tr> +<tr> +<td>[</td> +<td>91</td> +<td>123</td> +<td>27</td> +<td>0;26</td> +</tr> +<tr> +<td>]</td> +<td>93</td> +<td>125</td> +<td>29</td> +<td>0;27</td> +</tr> +<tr> +<td></td> +<td>92</td> +<td>124</td> +<td>28</td> +<td>0;43</td> +</tr> +<tr> +<td>;</td> +<td>59</td> +<td>58</td> +<td>--</td> +<td>0;39</td> +</tr> +<tr> +<td>'</td> +<td>39</td> +<td>34</td> +<td>--</td> +<td>0;40</td> +</tr> +<tr> +<td>,</td> +<td>44</td> +<td>60</td> +<td>--</td> +<td>0;51</td> +</tr> +<tr> +<td>.</td> +<td>46</td> +<td>62</td> +<td>--</td> +<td>0;52</td> +</tr> +<tr> +<td>/</td> +<td>47</td> +<td>63</td> +<td>--</td> +<td>0;53</td> +</tr> +<tr> +<td>`</td> +<td>96</td> +<td>126</td> +<td>--</td> +<td>(0;41)</td> +</tr> +<tr> +<td>ENTER (keypad)</td> +<td>13</td> +<td>--</td> +<td>10</td> +<td>(0;166)</td> +</tr> +<tr> +<td>/ (keypad)</td> +<td>47</td> +<td>47</td> +<td>(0;142)</td> +<td>(0;74)</td> +</tr> +<tr> +<td>* (keypad)</td> +<td>42</td> +<td>(0;144)</td> +<td>(0;78)</td> +<td>--</td> +</tr> +<tr> +<td>- (keypad)</td> +<td>45</td> +<td>45</td> +<td>(0;149)</td> +<td>(0;164)</td> +</tr> +<tr> +<td>+ (keypad)</td> +<td>43</td> +<td>43</td> +<td>(0;150)</td> +<td>(0;55)</td> +</tr> +<tr> +<td>5 (keypad)</td> +<td>(0;76)</td> +<td>53</td> +<td>(0;143)</td> +<td>--</td> +</tr> +</tbody> +</table> +<h2 id="resources">Resources</h2> +<ul> +<li><a href="https://en.wikipedia.org/wiki/ANSI_escape_code">Wikipedia: ANSI escape code</a></li> +<li><a href="http://www.lihaoyi.com/post/BuildyourownCommandLinewithANSIescapecodes.html">Build your own Command Line with ANSI escape codes</a></li> +<li><a href="http://ascii-table.com/ansi-escape-sequences.php">ascii-table: ANSI Escape sequences</a></li> +<li><a href="https://bluesock.org/~willkg/dev/ansi.html">bluesock: ansi codes</a></li> +<li><a href="http://wiki.bash-hackers.org/scripting/terminalcodes">bash-hackers: Terminal Codes (ANSI/VT100) introduction</a></li> +<li><a href="https://invisible-island.net/xterm/ctlseqs/ctlseqs.html">XTerm Control Sequences</a></li> +<li><a href="https://vt100.net/">VT100 – Various terminal manuals</a></li> +<li><a href="https://xtermjs.org/docs/api/vtfeatures/">xterm.js – Supported Terminal Sequences</a></li> +</ul> + + </div> + + <div class="row"> + <div class="col-xs-12"> + + </div> + </div> + + + <div style="height: 50px;"></div> + + + <div class="site-footer"> + + + +</div> + + </div> + </div> + </article> + + + +<script> + + + + + +</script> + + + +</body> + +</html> diff --git a/posts/6/index.html b/posts/6/index.html new file mode 100644 index 0000000..6c2617d --- /dev/null +++ b/posts/6/index.html @@ -0,0 +1,359 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8" /> + <meta name="generator" content="Hugo 0.105.0"> + + <meta http-equiv="X-UA-Compatible" content="IE=edge" /> + <meta name="viewport" content="width=device-width, initial-scale=1" /> + <meta name="author" content="garhve" /> + <meta property="og:url" content="https://blog.garhve.com/posts/6/" /> + <link rel="canonical" href="https://blog.garhve.com/posts/6/" /><link rel="alternate" type="application/atom+xml" href="https://blog.garhve.comindex.xml" title="blog | garhve's hub"> + + <script type="application/ld+json"> + { + "@context" : "http://schema.org", + "@type" : "BlogPosting", + "mainEntityOfPage": { + "@type": "WebPage", + "@id": "https:\/\/blog.garhve.com" + }, + "articleSection" : "posts", + "name" : "Mess with Bash(2)", + "headline" : "Mess with Bash(2)", + "description" : "More info is in this tutorial\nall value expansions (ie. all syntax with a $ prefix) can only expand inside quoted arguments if the argument was double-quoted . Single quotes will turn the dollar-syntax into literal characters, causing bash to output the dollar rather than expand its value in-place!\n\u0026ldquo;Value expansions ($...) must always be double-quoted.\u0026rdquo;\nNever leave a value expansion unquoted.\nRedirection File Redirection 0 is standard input, 1 is standard output, 2 is standard error", + "inLanguage" : "en-US", + "author" : "garhve", + "creator" : "garhve", + "publisher": "garhve", + "accountablePerson" : "garhve", + "copyrightHolder" : "garhve", + "copyrightYear" : "2022", + "datePublished": "2022-09-29 09:43:02 \u002b0800 CST", + "dateModified" : "2022-09-29 09:43:02 \u002b0800 CST", + "url" : "https:\/\/blog.garhve.com\/posts\/6\/", + "keywords" : [ ] + } +</script> +<title>Mess with Bash(2)</title> + <meta property="og:title" content="Mess with Bash(2)" /> + <meta property="og:type" content="article" /> + <meta property="og:description" content="More info is in this tutorial +all value expansions (ie. all syntax with a $ prefix) can only expand inside quoted arguments if the argument was double-quoted . Single quotes will turn the dollar-syntax into literal characters, causing bash to output the dollar rather than expand its value in-place! +&ldquo;Value expansions ($...) must always be double-quoted.&rdquo; +Never leave a value expansion unquoted. +Redirection File Redirection 0 is standard input, 1 is standard output, 2 is standard error" /> + <meta name="description" content="More info is in this tutorial +all value expansions (ie. all syntax with a $ prefix) can only expand inside quoted arguments if the argument was double-quoted . Single quotes will turn the dollar-syntax into literal characters, causing bash to output the dollar rather than expand its value in-place! +&ldquo;Value expansions ($...) must always be double-quoted.&rdquo; +Never leave a value expansion unquoted. +Redirection File Redirection 0 is standard input, 1 is standard output, 2 is standard error" /> + <meta property="og:locale" content="en-us" /><meta property="og:image" content="" /> + + + + + <style>body{font-family:bree serif,sans-serif;-webkit-font-smoothing:antialiased;margin:0 20px}article{max-width:800px;margin-left:auto;margin-right:auto}a{color:#000;text-decoration:none}a:hover{font-weight:600;text-decoration:underline}.post-ads{margin:50px 0}.markdown-body{font-size:18px;max-width:100%}.markdown-body a{text-decoration:underline;text-decoration-color:#000}.markdown-body blockquote{margin:0;padding:0 1em;color:#57606a;border-left:.25em solid #d0d7de}.markdown-body pre{padding:16px;overflow:auto;border-radius:10px}.markdown-body code{padding:.2em .4em;font-size:85%;background-color:#f6f8fa;border-radius:6px;font-family:fira code,monospace}.markdown-body pre>code{padding:0;font-size:80%;background-color:inherit;border:0;font-family:fira code,monospace}.Chinese .markdown-body{line-height:200%}.site-date-catalog{font-size:2rem}.header-title{font-size:2rem;font-weight:700;margin-top:32px;font-family:bungee shade,sans-serif}.header-title a{text-decoration:none}.header-subtitle{color:#666}.header-items{margin:10px 0}.header-item{margin:0 5px}.header-line{width:100%;border-width:2px;border-color:#482936;border-style:solid none none none}.lang-switch{font-weight:600}#posts-list{min-height:600px}.posts-line{font-size:1.2rem;margin:12px 0}.posts-categories{font-size:.8rem;margin:auto;text-align:center}.posts-category{padding:3px 0;border:#000 2px solid;border-radius:5px}.site-footer{margin-top:50px}.site-footer-item{margin-right:12px}.post-content img{max-width:100%;display:block;margin-right:auto;margin-top:12px}.post-header{margin-bottom:50px}.post-title{font-size:2rem;font-weight:600}.post-tags{display:inline;font-weight:600;padding:2px 5px;margin-right:6px;border:#000 2px solid;border-radius:5px}.post-date{font-weight:800;font-style:italic}.post-author{float:right;font-weight:600}.page-content{min-height:60%}.post-content{margin-bottom:50px}.post-content p{hyphens:auto;line-height:1.8;text-justify:ideographic;margin-bottom:1em}.related-content{border-width:3px;border-style:solid;border-color:#000;padding:0 10px;margin-bottom:50px;margin-top:100px}.related-content li{margin:5px 0}.taxonomy-term{font-size:3rem}.gallery-img{text-align:center}.gallery-img span{text-align:center}.gallery-img-desc{font-size:.8em;font-weight:800}#disqus_thread{position:relative}#disqus_thread:after{content:"";display:block;height:55px;width:100%;position:absolute;bottom:0;background:#fff}@media screen and (max-width:600px){.header-title,.header-subtitle,.header-items{text-align:center}.posts-line{font-size:16px}.markdown-body{font-size:16px}.post-title{font-size:2rem}.post-content p{letter-spacing:.05em}}@media screen and (max-width:48em){.posts-category{display:none}}</style> + + + <style>.container,.container-fluid{margin-right:auto;margin-left:auto}.container-fluid{padding-right:2rem;padding-left:2rem}.row{box-sizing:border-box;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-flex:0;-ms-flex:0 1 auto;flex:initial;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:wrap;flex-wrap:wrap;margin-right:-.5rem;margin-left:-.5rem}.row.reverse{-webkit-box-orient:horizontal;-webkit-box-direction:reverse;-ms-flex-direction:row-reverse;flex-direction:row-reverse}.col.reverse{-webkit-box-orient:vertical;-webkit-box-direction:reverse;-ms-flex-direction:column-reverse;flex-direction:column-reverse}.col-xs,.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9,.col-xs-offset-0,.col-xs-offset-1,.col-xs-offset-10,.col-xs-offset-11,.col-xs-offset-12,.col-xs-offset-2,.col-xs-offset-3,.col-xs-offset-4,.col-xs-offset-5,.col-xs-offset-6,.col-xs-offset-7,.col-xs-offset-8,.col-xs-offset-9{box-sizing:border-box;-webkit-box-flex:0;-ms-flex:0 0 auto;flex:none;padding-right:.5rem;padding-left:.5rem}.col-xs{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-preferred-size:0;flex-basis:0;max-width:100%}.col-xs-1{-ms-flex-preferred-size:8.33333333%;flex-basis:8.33333333%;max-width:8.33333333%}.col-xs-2{-ms-flex-preferred-size:16.66666667%;flex-basis:16.66666667%;max-width:16.66666667%}.col-xs-3{-ms-flex-preferred-size:25%;flex-basis:25%;max-width:25%}.col-xs-4{-ms-flex-preferred-size:33.33333333%;flex-basis:33.33333333%;max-width:33.33333333%}.col-xs-5{-ms-flex-preferred-size:41.66666667%;flex-basis:41.66666667%;max-width:41.66666667%}.col-xs-6{-ms-flex-preferred-size:50%;flex-basis:50%;max-width:50%}.col-xs-7{-ms-flex-preferred-size:58.33333333%;flex-basis:58.33333333%;max-width:58.33333333%}.col-xs-8{-ms-flex-preferred-size:66.66666667%;flex-basis:66.66666667%;max-width:66.66666667%}.col-xs-9{-ms-flex-preferred-size:75%;flex-basis:75%;max-width:75%}.col-xs-10{-ms-flex-preferred-size:83.33333333%;flex-basis:83.33333333%;max-width:83.33333333%}.col-xs-11{-ms-flex-preferred-size:91.66666667%;flex-basis:91.66666667%;max-width:91.66666667%}.col-xs-12{-ms-flex-preferred-size:100%;flex-basis:100%;max-width:100%}.col-xs-offset-0{margin-left:0}.col-xs-offset-1{margin-left:8.33333333%}.col-xs-offset-2{margin-left:16.66666667%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-4{margin-left:33.33333333%}.col-xs-offset-5{margin-left:41.66666667%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-7{margin-left:58.33333333%}.col-xs-offset-8{margin-left:66.66666667%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-10{margin-left:83.33333333%}.col-xs-offset-11{margin-left:91.66666667%}.start-xs{-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;text-align:start}.center-xs{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;text-align:center}.end-xs{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;text-align:end}.top-xs{-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start}.middle-xs{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.bottom-xs{-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end}.around-xs{-ms-flex-pack:distribute;justify-content:space-around}.between-xs{-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.first-xs{-webkit-box-ordinal-group:0;-ms-flex-order:-1;order:-1}.last-xs{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}@media only screen and (min-width:48em){.container{width:49rem}.col-sm,.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-sm-offset-0,.col-sm-offset-1,.col-sm-offset-10,.col-sm-offset-11,.col-sm-offset-12,.col-sm-offset-2,.col-sm-offset-3,.col-sm-offset-4,.col-sm-offset-5,.col-sm-offset-6,.col-sm-offset-7,.col-sm-offset-8,.col-sm-offset-9{box-sizing:border-box;-webkit-box-flex:0;-ms-flex:0 0 auto;flex:none;padding-right:.5rem;padding-left:.5rem}.col-sm{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-preferred-size:0;flex-basis:0;max-width:100%}.col-sm-1{-ms-flex-preferred-size:8.33333333%;flex-basis:8.33333333%;max-width:8.33333333%}.col-sm-2{-ms-flex-preferred-size:16.66666667%;flex-basis:16.66666667%;max-width:16.66666667%}.col-sm-3{-ms-flex-preferred-size:25%;flex-basis:25%;max-width:25%}.col-sm-4{-ms-flex-preferred-size:33.33333333%;flex-basis:33.33333333%;max-width:33.33333333%}.col-sm-5{-ms-flex-preferred-size:41.66666667%;flex-basis:41.66666667%;max-width:41.66666667%}.col-sm-6{-ms-flex-preferred-size:50%;flex-basis:50%;max-width:50%}.col-sm-7{-ms-flex-preferred-size:58.33333333%;flex-basis:58.33333333%;max-width:58.33333333%}.col-sm-8{-ms-flex-preferred-size:66.66666667%;flex-basis:66.66666667%;max-width:66.66666667%}.col-sm-9{-ms-flex-preferred-size:75%;flex-basis:75%;max-width:75%}.col-sm-10{-ms-flex-preferred-size:83.33333333%;flex-basis:83.33333333%;max-width:83.33333333%}.col-sm-11{-ms-flex-preferred-size:91.66666667%;flex-basis:91.66666667%;max-width:91.66666667%}.col-sm-12{-ms-flex-preferred-size:100%;flex-basis:100%;max-width:100%}.col-sm-offset-0{margin-left:0}.col-sm-offset-1{margin-left:8.33333333%}.col-sm-offset-2{margin-left:16.66666667%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-4{margin-left:33.33333333%}.col-sm-offset-5{margin-left:41.66666667%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-7{margin-left:58.33333333%}.col-sm-offset-8{margin-left:66.66666667%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-10{margin-left:83.33333333%}.col-sm-offset-11{margin-left:91.66666667%}.start-sm{-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;text-align:start}.center-sm{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;text-align:center}.end-sm{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;text-align:end}.top-sm{-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start}.middle-sm{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.bottom-sm{-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end}.around-sm{-ms-flex-pack:distribute;justify-content:space-around}.between-sm{-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.first-sm{-webkit-box-ordinal-group:0;-ms-flex-order:-1;order:-1}.last-sm{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}}@media only screen and (min-width:64em){.container{width:65rem}.col-md,.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-md-offset-0,.col-md-offset-1,.col-md-offset-10,.col-md-offset-11,.col-md-offset-12,.col-md-offset-2,.col-md-offset-3,.col-md-offset-4,.col-md-offset-5,.col-md-offset-6,.col-md-offset-7,.col-md-offset-8,.col-md-offset-9{box-sizing:border-box;-webkit-box-flex:0;-ms-flex:0 0 auto;flex:none;padding-right:.5rem;padding-left:.5rem}.col-md{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-preferred-size:0;flex-basis:0;max-width:100%}.col-md-1{-ms-flex-preferred-size:8.33333333%;flex-basis:8.33333333%;max-width:8.33333333%}.col-md-2{-ms-flex-preferred-size:16.66666667%;flex-basis:16.66666667%;max-width:16.66666667%}.col-md-3{-ms-flex-preferred-size:25%;flex-basis:25%;max-width:25%}.col-md-4{-ms-flex-preferred-size:33.33333333%;flex-basis:33.33333333%;max-width:33.33333333%}.col-md-5{-ms-flex-preferred-size:41.66666667%;flex-basis:41.66666667%;max-width:41.66666667%}.col-md-6{-ms-flex-preferred-size:50%;flex-basis:50%;max-width:50%}.col-md-7{-ms-flex-preferred-size:58.33333333%;flex-basis:58.33333333%;max-width:58.33333333%}.col-md-8{-ms-flex-preferred-size:66.66666667%;flex-basis:66.66666667%;max-width:66.66666667%}.col-md-9{-ms-flex-preferred-size:75%;flex-basis:75%;max-width:75%}.col-md-10{-ms-flex-preferred-size:83.33333333%;flex-basis:83.33333333%;max-width:83.33333333%}.col-md-11{-ms-flex-preferred-size:91.66666667%;flex-basis:91.66666667%;max-width:91.66666667%}.col-md-12{-ms-flex-preferred-size:100%;flex-basis:100%;max-width:100%}.col-md-offset-0{margin-left:0}.col-md-offset-1{margin-left:8.33333333%}.col-md-offset-2{margin-left:16.66666667%}.col-md-offset-3{margin-left:25%}.col-md-offset-4{margin-left:33.33333333%}.col-md-offset-5{margin-left:41.66666667%}.col-md-offset-6{margin-left:50%}.col-md-offset-7{margin-left:58.33333333%}.col-md-offset-8{margin-left:66.66666667%}.col-md-offset-9{margin-left:75%}.col-md-offset-10{margin-left:83.33333333%}.col-md-offset-11{margin-left:91.66666667%}.start-md{-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;text-align:start}.center-md{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;text-align:center}.end-md{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;text-align:end}.top-md{-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start}.middle-md{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.bottom-md{-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end}.around-md{-ms-flex-pack:distribute;justify-content:space-around}.between-md{-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.first-md{-webkit-box-ordinal-group:0;-ms-flex-order:-1;order:-1}.last-md{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}}@media only screen and (min-width:75em){.container{width:76rem}.col-lg,.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-lg-offset-0,.col-lg-offset-1,.col-lg-offset-10,.col-lg-offset-11,.col-lg-offset-12,.col-lg-offset-2,.col-lg-offset-3,.col-lg-offset-4,.col-lg-offset-5,.col-lg-offset-6,.col-lg-offset-7,.col-lg-offset-8,.col-lg-offset-9{box-sizing:border-box;-webkit-box-flex:0;-ms-flex:0 0 auto;flex:none;padding-right:.5rem;padding-left:.5rem}.col-lg{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-preferred-size:0;flex-basis:0;max-width:100%}.col-lg-1{-ms-flex-preferred-size:8.33333333%;flex-basis:8.33333333%;max-width:8.33333333%}.col-lg-2{-ms-flex-preferred-size:16.66666667%;flex-basis:16.66666667%;max-width:16.66666667%}.col-lg-3{-ms-flex-preferred-size:25%;flex-basis:25%;max-width:25%}.col-lg-4{-ms-flex-preferred-size:33.33333333%;flex-basis:33.33333333%;max-width:33.33333333%}.col-lg-5{-ms-flex-preferred-size:41.66666667%;flex-basis:41.66666667%;max-width:41.66666667%}.col-lg-6{-ms-flex-preferred-size:50%;flex-basis:50%;max-width:50%}.col-lg-7{-ms-flex-preferred-size:58.33333333%;flex-basis:58.33333333%;max-width:58.33333333%}.col-lg-8{-ms-flex-preferred-size:66.66666667%;flex-basis:66.66666667%;max-width:66.66666667%}.col-lg-9{-ms-flex-preferred-size:75%;flex-basis:75%;max-width:75%}.col-lg-10{-ms-flex-preferred-size:83.33333333%;flex-basis:83.33333333%;max-width:83.33333333%}.col-lg-11{-ms-flex-preferred-size:91.66666667%;flex-basis:91.66666667%;max-width:91.66666667%}.col-lg-12{-ms-flex-preferred-size:100%;flex-basis:100%;max-width:100%}.col-lg-offset-0{margin-left:0}.col-lg-offset-1{margin-left:8.33333333%}.col-lg-offset-2{margin-left:16.66666667%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-4{margin-left:33.33333333%}.col-lg-offset-5{margin-left:41.66666667%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-7{margin-left:58.33333333%}.col-lg-offset-8{margin-left:66.66666667%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-10{margin-left:83.33333333%}.col-lg-offset-11{margin-left:91.66666667%}.start-lg{-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;text-align:start}.center-lg{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;text-align:center}.end-lg{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;text-align:end}.top-lg{-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start}.middle-lg{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.bottom-lg{-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end}.around-lg{-ms-flex-pack:distribute;justify-content:space-around}.between-lg{-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.first-lg{-webkit-box-ordinal-group:0;-ms-flex-order:-1;order:-1}.last-lg{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}}</style> + + + + + <link href="/index.xml" rel="alternate" type="application/rss+xml" + title="blog | garhve's hub"> + + <link rel="preconnect" href="https://fonts.gstatic.com"> + <link href="https://fonts.googleapis.com/css?family=Bree+Serif|Bungee+Shade" rel="stylesheet"> + + + +</head> + + +<body> + <article class="post English" id="article"> + <div class="row"> + <div class="col-xs-12"> + <div class="site-header"> + +<header> + <div class="header-title"> + <a href="/" + >Garhve</a + > + </div> + <div class="header-subtitle"></div> +</header> +<div class="row end-md center-xs header-items"> +</div> +<div class="row end-xs"> + + <div class="lang-switch col-xs-3 col-xs-offset-9"> + <a href="/cn/">Chinese</a> + </div> + +</div> +<div class="header-line"></div> + + </div> + <header class="post-header"> + <h1 class="post-title">Mess with Bash(2)</h1> + + <div class="row post-desc"> + <div class="col-xs-6"> + + <time class="post-date" datetime="2022-09-29 09:43:02 CST"> + 29 Sep 2022 + </time> + + </div> + <div class="col-xs-6"> + + <div class="post-author"> + <a target="_blank" href="https://garhve.com">@garhve</a> + </div> + + </div> + </div> + + </header> + + <div class="post-content markdown-body"> + + <blockquote> +<p>More info is in this <a href="https://https://guide.bash.academy">tutorial</a></p> +</blockquote> +<blockquote> +<p>all value expansions (ie. all syntax with a <code>$</code> prefix) can only expand inside quoted arguments if the argument was <em>double-quoted</em> . Single quotes will turn the dollar-syntax into literal characters, causing bash to output the dollar rather than expand its value in-place!</p> +</blockquote> +<p><em>“Value expansions (<code>$...</code>) must <strong>always</strong> be double-quoted.”</em></p> +<p><em>Never leave a value expansion unquoted.</em></p> +<h2 id="redirection">Redirection</h2> +<h3 id="file-redirection">File Redirection</h3> +<p><strong>0 is standard input, 1 is standard output, 2 is standard error</strong></p> +<p><code>[x] > file, [x] < file</code></p> +<p>Make <em><strong>File descriptor</strong></em>(FD) <code>x</code> write to / read from file.</p> +<blockquote> +<p><code>echo hello > ~/World</code></p> +<p><code>read line < ~/Word</code></p> +<p><code>rm file 2>/dev/null</code></p> +</blockquote> +<h3 id="file-descriptor-copying">File Descriptor copying</h3> +<p><code>[x] >& y, [x] <& y</code></p> +<p>make FD <code>x</code> write to / read from FD <code>y</code>’s stream</p> +<blockquote> +<p>the connection to the stream used by FD <code>y</code> is copied to FD <code>x</code></p> +<p><code>curl cip.cc > result 2>&1</code></p> +<p><code>ping localhost > result 2>&1</code></p> +<div class="highlight"><pre tabindex="0" style="background-color:#fff;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="font-style:italic"># exec can be used to change the file descriptors of bash itself,</span> +</span></span><span style="display:flex;"><span><span style="font-style:italic"># and if you use an x that doesn't yet exist,</span> +</span></span><span style="display:flex;"><span><span style="font-style:italic"># bash will create a new file descriptor ("plug") for you with that number.</span> +</span></span><span style="display:flex;"><span><span style="font-style:italic"># - in command is to close new FD 3 we'd created before.</span> +</span></span><span style="display:flex;"><span><span style="font-style:italic"># >&- is to close FD 1, <&- is to close FD0</span> +</span></span><span style="display:flex;"><span>exec 3>&1 >mylog; echo moo; exec 1>&3 3>&- +</span></span></code></pre></div></blockquote> +<h3 id="appending-file-redirection">Appending file redirection</h3> +<p><code>[x] >> file</code></p> +<p>make FD <code>x</code> append to end of the file</p> +<blockquote> +<p>A stream to <code>file</code> is opened for writing in append mode and is connected to file descriptor <code>x</code>. The regular file redirection operator <code>></code> empties the file’s contents when it opens the file so that only your bytes will be in the file.</p> +<p><code>echo hello >> ~/world</code></p> +<p><code>echo world >> ~/world</code></p> +</blockquote> +<h3 id="redirecting-standard-output-and-standard-error">Redirecting standard output and standard error</h3> +<p><code>&>file</code></p> +<p>Make both FD 1 (standard output) and FD 2 (standard error) write to file</p> +<blockquote> +<p>This is a convenience operator which does the same thing as <code>>file 2>&1</code> but is more concise. Again, you can append rather than truncate by doubling the arrow: <code>&>>file</code></p> +<p><code>ping localhost &>result</code></p> +</blockquote> +<h3 id="here-documents">Here documents</h3> +<div class="highlight"><pre tabindex="0" style="background-color:#fff;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="font-style:italic"><<delimiter +</span></span></span><span style="display:flex;"><span><span style="font-style:italic"> Here document +</span></span></span><span style="display:flex;"><span><span style="font-style:italic">delimiter</span> +</span></span></code></pre></div><p>Make FD 0 read from the string between <code>delimiter</code>s</p> +<blockquote> +<p>Here-Documents are great for reading blocks of text to command line.</p> +<div class="highlight"><pre tabindex="0" style="background-color:#fff;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>cat <span style="font-style:italic"><< EOF +</span></span></span><span style="display:flex;"><span><span style="font-style:italic">this is within here document +</span></span></span><span style="display:flex;"><span><span style="font-style:italic">I can write as many lines as I like +</span></span></span><span style="display:flex;"><span><span style="font-style:italic">and terminate with line of demiliter only +</span></span></span><span style="display:flex;"><span><span style="font-style:italic">EOF</span> //end of heredoc +</span></span></code></pre></div></blockquote> +<h3 id="here-strings">Here strings</h3> +<p><code><<< string</code></p> +<p>Make FD 0 read from the <code>string</code></p> +<blockquote> +<p>Here strings are very similar to here documents but more concise. They are generally preferred over here documents.</p> +<div class="highlight"><pre tabindex="0" style="background-color:#fff;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>cat <<< <span style="font-style:italic">"This, +</span></span></span><span style="display:flex;"><span><span style="font-style:italic">is the here strings. tab will also be read."</span> +</span></span></code></pre></div></blockquote> +<h3 id="moving-file-decipher">Moving file decipher</h3> +<p><code>[x]>&y-, [x]<&y-</code></p> +<p>Replace FD <code>x</code> with FD <code>y</code> and close FD <code>y</code></p> +<blockquote> +<p>Easy way of <code>[x]>&y, y>&-</code></p> +<div class="highlight"><pre tabindex="0" style="background-color:#fff;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="font-style:italic"># 3>&1-: copy FD 1 to FD 3 and close FD 1.</span> +</span></span><span style="display:flex;"><span><span style="font-style:italic"># >&3-: copy FD 3 to FD 1 and close FD 3.</span> +</span></span><span style="display:flex;"><span>exec 3>&1- >mylog; echo moo; exec >&3- +</span></span></code></pre></div></blockquote> +<h3 id="reading-and-writing-with-file-descriptor">Reading and writing with file descriptor</h3> +<p><code>[x] <> file</code></p> +<p>Open FD <code>x</code> for both reading and writing to <code>file</code></p> +<blockquote> +<p>The file descriptor at x is opened with a stream to the file that can be used for writing as well as reading bytes. Usually you’ll use two file descriptors for this. <strong>One of the rare cases where this is useful is when setting up a stream with a read/write device such as a network socket</strong>.</p> +<div class="highlight"><pre tabindex="0" style="background-color:#fff;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>exec 5<>aFile +</span></span><span style="display:flex;"><span>cat >&5 <span style="font-style:italic">"Hello world"</span> <span style="font-style:italic"># make FD 1 write to where FD 5 currently writing, copy file descriptor FD 5 to FD 1</span> +</span></span><span style="display:flex;"><span>cat <&5 <span style="font-style:italic"># make FD 0 read from where FD 5 currently reading, copy file descriptor FD 5 to FD 0, then cat will send content to FD 1</span> +</span></span></code></pre></div></blockquote> +<p>Exercise</p> +<blockquote> +<p>Q: fix <code>exec 3>&2 2>log; echo 'Hello!'; exec 2>&3</code> so that the message is properly saved into the <code>log</code> file and such that FD 3 is properly closed afterwards:</p> +<p>A:</p> +<ol> +<li><code>exec 3>&1- 3>log; echo 'Hello!'; exec 1>&3-</code></li> +<li><code>exec 3>&1 1>&- 3>log; echo 'Hello!'; exec 1>&3 3>&-</code></li> +</ol> +</blockquote> +<h2 id="expansion">Expansion</h2> +<h3 id="pathname-expansion">pathname expansion</h3> +<ol> +<li> +<p>pattern expansion is performed by bash before command even execute</p> +<blockquote> +<p><code>file *</code> will show info about all file in current directory. <code>*</code> will expand to content before <code>file</code> execute.</p> +</blockquote> +</li> +<li> +<p>A <em>glob</em> is the name of the type of pattern supported by the bash shell.</p> +<blockquote> +<p>basic glob name supported by bash<img src="https://assets.garhve.com/pictures/screenshots/2022/10/1665123982.png" alt="explanation"></p> +<p><img src="https://assets.garhve.com/pictures/screenshots/2022/10/1665133964.png" alt="example"></p> +<p><strong>Those glob will only affect current directory, explicit expression is required to working on other directory.</strong> <code>ls /sub/*</code></p> +</blockquote> +</li> +<li> +<p>extended glob can be enable to get more powerful but also easy confusing feature of bash</p> +<blockquote> +<p>bash: <code>shopt -s extglob</code> +zsh. : <code>setopt extendedglob</code> +<img src="https://assets.garhve.com/pictures/screenshots/2022/10/1665134156.png" alt="explanation"></p> +<p><img src="https://assets.garhve.com/pictures/screenshots/2022/10/1665134205.png" alt="!(my)* get expand because of * is outside !(), which makes it expland another whole pathname"></p> +</blockquote> +</li> +</ol> +<h3 id="command-substitution">Command Substitution</h3> +<p>we can expansion commands within commands, but must use double-quote <code>""</code> instead of <code>''</code></p> +<div class="highlight"><pre tabindex="0" style="background-color:#fff;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="font-style:italic"># this will output contents in hello.h to screen</span> +</span></span><span style="display:flex;"><span>cat hello.h +</span></span><span style="display:flex;"><span> +</span></span><span style="display:flex;"><span><span style="font-style:italic"># this will expand `cat hello.h` to real contents in </span> +</span></span><span style="display:flex;"><span><span style="font-style:italic"># file hello.h and concatenate to previous sentence</span> +</span></span><span style="display:flex;"><span>echo <span style="font-style:italic">"file hello.h contains contents of </span><span style="font-weight:bold">$(</span>cat hello.h<span style="font-weight:bold">)</span><span style="font-style:italic">"</span> +</span></span><span style="display:flex;"><span> +</span></span><span style="display:flex;"><span><span style="font-style:italic"># this will output 'file hello.h contains contents of $(cat hello.h)'</span> +</span></span><span style="display:flex;"><span><span style="font-style:italic"># without expand command in $()</span> +</span></span><span style="display:flex;"><span>echo <span style="font-style:italic">'file hello.h contains contents of $(cat hello.h)'</span> +</span></span></code></pre></div><p>In command, <code>$()</code> is called <em>value expansion</em>, it consists of value-expansion prefix <code>$</code> and subshell <code>(...)</code>. A subshell is essentially a small new bash process that is used to run a command while the main bash shell waits for the result.</p> +<h2 id="parameters">Parameters</h2> +<p>There are three kind of parameters:</p> +<ol> +<li>Environment Parameter</li> +<li>Positional Parameter</li> +<li>Variables</li> +</ol> +<h3 id="environment-parameter">Environment Parameter</h3> +<p>environment variables exist at the process level. That means they are not a feature of the bash shell, but rather a feature of any program process on your system. They can inherit by children, but children’s EV can’t be given to parent.</p> +<h3 id="positional-parameter">Positional Parameter</h3> +<p>Just as name indicates, these kind of parameters indicate arguments’ position, and always starting from 0.</p> +<p>for example, imaging we have a script <code>rename</code>, arguments could be passed to it to extend its usage:</p> +<p><code>rename dir name</code> there, we passed <code>dir</code> and <code>name</code> as argument, so that positional parameters in script would be <code>$1</code> and <code>$2</code>, representing arguments respectively. after <code>$2</code>, such as <code>$3</code> is unset since there has no more argument.</p> +<blockquote> +<p>Positional Parameter is read-only</p> +</blockquote> +<p>a new usage: <code>bash -c 'ls "$1"' -- '/home'</code>. This will working like <code>ls /home</code>, dash is necessary since it is first variable in shell we ran commands and it makes positional value of arguments populated after it stand as we expect in shell single-quoted command gonna run in.</p> +<h3 id="special-parameter">Special Parameter</h3> +<p>Special parameters are parameters whose name is a single symbolic character, they are used to request certain state information from the bash shell. Like positional parameter, they are <em>read-only</em>.</p> +<p><img src="https://assets.garhve.com/pictures/screenshots/2022/10/1666054171.png" alt="different kinds of special parameters and the information they hold"></p> +<h3 id="variables">Variables</h3> +<p>definition: <code>name=value</code> <em>//no space around <code>=</code> like other programming language support</em></p> +<p>call: like <em>command expansion</em>, using variable is to expand it with prefix <code>$</code>, e.g. <code>$name</code></p> +<ul> +<li>Keep in mind, Expansion should always be double-quoted *</li> +</ul> +<h3 id="parameter-expansion">Parameter expansion</h3> +<blockquote> +<p><a href="https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html">GNU material</a></p> +</blockquote> +<p>we expand parameters by prefixing their name with a <code>$</code> symbol</p> +<blockquote> +<p>e.g. <code>name=me; echo hello "$name"</code>. <code>hello me</code>.</p> +</blockquote> +<p>In addition, we can put braces (<code>{</code> and <code>}</code>) around our parameter, which indicates where variable is about to begin and end.</p> +<blockquote> +<p>e.g. <code>name=orange; echo there are 4 "${name}s"</code> <code>there are 4 oranges</code>.</p> +<div class="highlight"><pre tabindex="0" style="background-color:#fff;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>name=orange +</span></span><span style="display:flex;"><span>echo <span style="font-style:italic">"there are 4 </span><span style="font-weight:bold;font-style:italic">${</span>name<span style="font-weight:bold;font-style:italic">}</span><span style="font-style:italic">s."</span> <span style="font-style:italic"># there are 4 oranges.</span> +</span></span><span style="display:flex;"><span>echo <span style="font-style:italic">"there are 4 </span>$names<span style="font-style:italic">."</span> <span style="font-style:italic"># there are 4 .</span> +</span></span></code></pre></div><p>here, we put <code>{}</code>around<code>name</code>so that bash can be told that suffix <code>s</code> is not a part of variable. otherwise, it will treat <code>names</code> as parameter and looking for its value, which is none in our example.</p> +</blockquote> +<p>parameter expansion brings up a powerful feature: <em>parameter expansion oerators</em></p> +<blockquote> +<p>While expanding a parameter, it is possible to apply an operator to the expanding value without alternate original value.</p> +<p>I use these mostly</p> +<div class="highlight"><pre tabindex="0" style="background-color:#fff;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="font-style:italic"># remove string before pattern ${name#pattern} shortest ${name##pattern} longest</span> +</span></span><span style="display:flex;"><span><span style="font-style:italic"># remove string after pattern ${name%pattern} longest ${name%%pattern} shortest</span> +</span></span><span style="display:flex;"><span><span style="font-style:italic"># delete first matching pattern ${name/pattern}</span> +</span></span><span style="display:flex;"><span><span style="font-style:italic"># delete all matching pattern ${name//pattern}</span> +</span></span><span style="display:flex;"><span><span style="font-style:italic"># substitute pattern with string ${name//pattern/string}</span> +</span></span><span style="display:flex;"><span> +</span></span><span style="display:flex;"><span>foo=<span style="font-style:italic">"foo-bar-foobar"</span> +</span></span><span style="display:flex;"><span>echo <span style="font-weight:bold;font-style:italic">${</span>foo#*-<span style="font-weight:bold;font-style:italic">}</span> <span style="font-style:italic"># echoes 'bar-foobar' (Removes 'foo-' because that matches '*-')</span> +</span></span><span style="display:flex;"><span>echo <span style="font-weight:bold;font-style:italic">${</span>foo##*-<span style="font-weight:bold;font-style:italic">}</span> <span style="font-style:italic"># echoes 'foobar' (Removes 'foo-bar-')</span> +</span></span><span style="display:flex;"><span>echo <span style="font-weight:bold;font-style:italic">${</span>foo%-*<span style="font-weight:bold;font-style:italic">}</span> <span style="font-style:italic"># echoes 'foo-bar'</span> +</span></span><span style="display:flex;"><span>echo <span style="font-weight:bold;font-style:italic">${</span>foo%%-*<span style="font-weight:bold;font-style:italic">}</span> <span style="font-style:italic"># echoes 'foo'</span> +</span></span><span style="display:flex;"><span>echo <span style="font-weight:bold;font-style:italic">${</span>foo/-<span style="font-weight:bold;font-style:italic">}</span> <span style="font-style:italic"># echoes 'foobar-foobar'</span> +</span></span><span style="display:flex;"><span>echo <span style="font-weight:bold;font-style:italic">${</span>foo//-<span style="font-weight:bold;font-style:italic">}</span> <span style="font-style:italic"># echoes 'foobarfoobar'</span> +</span></span><span style="display:flex;"><span>echo <span style="font-weight:bold;font-style:italic">${</span>foo//-/_<span style="font-weight:bold;font-style:italic">}</span> <span style="font-style:italic"># echoes 'foo_bar_foobar'</span> +</span></span></code></pre></div></blockquote> +<p><img src="https://assets.garhve.com/pictures/screenshots/2022/10/1665660923.png" alt="part of operators as shown picture"></p> + + </div> + + <div class="row"> + <div class="col-xs-12"> + + </div> + </div> + + + <div style="height: 50px;"></div> + + + <div class="site-footer"> + + + +</div> + + </div> + </div> + </article> + + + +<script> + + + + + +</script> + + + +</body> + +</html> diff --git a/posts/7/index.html b/posts/7/index.html new file mode 100644 index 0000000..788f339 --- /dev/null +++ b/posts/7/index.html @@ -0,0 +1,164 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8" /> + <meta name="generator" content="Hugo 0.105.0"> + + <meta http-equiv="X-UA-Compatible" content="IE=edge" /> + <meta name="viewport" content="width=device-width, initial-scale=1" /> + <meta name="author" content="garhve" /> + <meta property="og:url" content="https://blog.garhve.com/posts/7/" /> + <link rel="canonical" href="https://blog.garhve.com/posts/7/" /><link rel="alternate" type="application/atom+xml" href="https://blog.garhve.comindex.xml" title="blog | garhve's hub"> + + <script type="application/ld+json"> + { + "@context" : "http://schema.org", + "@type" : "BlogPosting", + "mainEntityOfPage": { + "@type": "WebPage", + "@id": "https:\/\/blog.garhve.com" + }, + "articleSection" : "posts", + "name" : "Past Is Great", + "headline" : "Past Is Great", + "description" : "Lately, there’s a sign has been keeping jumping out in front of my eyes. That the past is great!\nFirst is in the movie Midnight in Paris, directed by Woody Allen, which I just finished a week ago. It tells a story of how a screen writer love 20th century because his loving artists all living in it. Though he finally realize that he loves past because the present is imperfect.", + "inLanguage" : "en-US", + "author" : "garhve", + "creator" : "garhve", + "publisher": "garhve", + "accountablePerson" : "garhve", + "copyrightHolder" : "garhve", + "copyrightYear" : "2022", + "datePublished": "2022-11-07 09:16:15 \u002b0800 CST", + "dateModified" : "2022-11-07 09:16:15 \u002b0800 CST", + "url" : "https:\/\/blog.garhve.com\/posts\/7\/", + "keywords" : [ ] + } +</script> +<title>Past Is Great</title> + <meta property="og:title" content="Past Is Great" /> + <meta property="og:type" content="article" /> + <meta property="og:description" content="Lately, there’s a sign has been keeping jumping out in front of my eyes. That the past is great! +First is in the movie Midnight in Paris, directed by Woody Allen, which I just finished a week ago. It tells a story of how a screen writer love 20th century because his loving artists all living in it. Though he finally realize that he loves past because the present is imperfect." /> + <meta name="description" content="Lately, there’s a sign has been keeping jumping out in front of my eyes. That the past is great! +First is in the movie Midnight in Paris, directed by Woody Allen, which I just finished a week ago. It tells a story of how a screen writer love 20th century because his loving artists all living in it. Though he finally realize that he loves past because the present is imperfect." /> + <meta property="og:locale" content="en-us" /><meta property="og:image" content="" /> + + + + + <style>body{font-family:bree serif,sans-serif;-webkit-font-smoothing:antialiased;margin:0 20px}article{max-width:800px;margin-left:auto;margin-right:auto}a{color:#000;text-decoration:none}a:hover{font-weight:600;text-decoration:underline}.post-ads{margin:50px 0}.markdown-body{font-size:18px;max-width:100%}.markdown-body a{text-decoration:underline;text-decoration-color:#000}.markdown-body blockquote{margin:0;padding:0 1em;color:#57606a;border-left:.25em solid #d0d7de}.markdown-body pre{padding:16px;overflow:auto;border-radius:10px}.markdown-body code{padding:.2em .4em;font-size:85%;background-color:#f6f8fa;border-radius:6px;font-family:fira code,monospace}.markdown-body pre>code{padding:0;font-size:80%;background-color:inherit;border:0;font-family:fira code,monospace}.Chinese .markdown-body{line-height:200%}.site-date-catalog{font-size:2rem}.header-title{font-size:2rem;font-weight:700;margin-top:32px;font-family:bungee shade,sans-serif}.header-title a{text-decoration:none}.header-subtitle{color:#666}.header-items{margin:10px 0}.header-item{margin:0 5px}.header-line{width:100%;border-width:2px;border-color:#482936;border-style:solid none none none}.lang-switch{font-weight:600}#posts-list{min-height:600px}.posts-line{font-size:1.2rem;margin:12px 0}.posts-categories{font-size:.8rem;margin:auto;text-align:center}.posts-category{padding:3px 0;border:#000 2px solid;border-radius:5px}.site-footer{margin-top:50px}.site-footer-item{margin-right:12px}.post-content img{max-width:100%;display:block;margin-right:auto;margin-top:12px}.post-header{margin-bottom:50px}.post-title{font-size:2rem;font-weight:600}.post-tags{display:inline;font-weight:600;padding:2px 5px;margin-right:6px;border:#000 2px solid;border-radius:5px}.post-date{font-weight:800;font-style:italic}.post-author{float:right;font-weight:600}.page-content{min-height:60%}.post-content{margin-bottom:50px}.post-content p{hyphens:auto;line-height:1.8;text-justify:ideographic;margin-bottom:1em}.related-content{border-width:3px;border-style:solid;border-color:#000;padding:0 10px;margin-bottom:50px;margin-top:100px}.related-content li{margin:5px 0}.taxonomy-term{font-size:3rem}.gallery-img{text-align:center}.gallery-img span{text-align:center}.gallery-img-desc{font-size:.8em;font-weight:800}#disqus_thread{position:relative}#disqus_thread:after{content:"";display:block;height:55px;width:100%;position:absolute;bottom:0;background:#fff}@media screen and (max-width:600px){.header-title,.header-subtitle,.header-items{text-align:center}.posts-line{font-size:16px}.markdown-body{font-size:16px}.post-title{font-size:2rem}.post-content p{letter-spacing:.05em}}@media screen and (max-width:48em){.posts-category{display:none}}</style> + + + <style>.container,.container-fluid{margin-right:auto;margin-left:auto}.container-fluid{padding-right:2rem;padding-left:2rem}.row{box-sizing:border-box;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-flex:0;-ms-flex:0 1 auto;flex:initial;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:wrap;flex-wrap:wrap;margin-right:-.5rem;margin-left:-.5rem}.row.reverse{-webkit-box-orient:horizontal;-webkit-box-direction:reverse;-ms-flex-direction:row-reverse;flex-direction:row-reverse}.col.reverse{-webkit-box-orient:vertical;-webkit-box-direction:reverse;-ms-flex-direction:column-reverse;flex-direction:column-reverse}.col-xs,.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9,.col-xs-offset-0,.col-xs-offset-1,.col-xs-offset-10,.col-xs-offset-11,.col-xs-offset-12,.col-xs-offset-2,.col-xs-offset-3,.col-xs-offset-4,.col-xs-offset-5,.col-xs-offset-6,.col-xs-offset-7,.col-xs-offset-8,.col-xs-offset-9{box-sizing:border-box;-webkit-box-flex:0;-ms-flex:0 0 auto;flex:none;padding-right:.5rem;padding-left:.5rem}.col-xs{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-preferred-size:0;flex-basis:0;max-width:100%}.col-xs-1{-ms-flex-preferred-size:8.33333333%;flex-basis:8.33333333%;max-width:8.33333333%}.col-xs-2{-ms-flex-preferred-size:16.66666667%;flex-basis:16.66666667%;max-width:16.66666667%}.col-xs-3{-ms-flex-preferred-size:25%;flex-basis:25%;max-width:25%}.col-xs-4{-ms-flex-preferred-size:33.33333333%;flex-basis:33.33333333%;max-width:33.33333333%}.col-xs-5{-ms-flex-preferred-size:41.66666667%;flex-basis:41.66666667%;max-width:41.66666667%}.col-xs-6{-ms-flex-preferred-size:50%;flex-basis:50%;max-width:50%}.col-xs-7{-ms-flex-preferred-size:58.33333333%;flex-basis:58.33333333%;max-width:58.33333333%}.col-xs-8{-ms-flex-preferred-size:66.66666667%;flex-basis:66.66666667%;max-width:66.66666667%}.col-xs-9{-ms-flex-preferred-size:75%;flex-basis:75%;max-width:75%}.col-xs-10{-ms-flex-preferred-size:83.33333333%;flex-basis:83.33333333%;max-width:83.33333333%}.col-xs-11{-ms-flex-preferred-size:91.66666667%;flex-basis:91.66666667%;max-width:91.66666667%}.col-xs-12{-ms-flex-preferred-size:100%;flex-basis:100%;max-width:100%}.col-xs-offset-0{margin-left:0}.col-xs-offset-1{margin-left:8.33333333%}.col-xs-offset-2{margin-left:16.66666667%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-4{margin-left:33.33333333%}.col-xs-offset-5{margin-left:41.66666667%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-7{margin-left:58.33333333%}.col-xs-offset-8{margin-left:66.66666667%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-10{margin-left:83.33333333%}.col-xs-offset-11{margin-left:91.66666667%}.start-xs{-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;text-align:start}.center-xs{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;text-align:center}.end-xs{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;text-align:end}.top-xs{-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start}.middle-xs{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.bottom-xs{-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end}.around-xs{-ms-flex-pack:distribute;justify-content:space-around}.between-xs{-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.first-xs{-webkit-box-ordinal-group:0;-ms-flex-order:-1;order:-1}.last-xs{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}@media only screen and (min-width:48em){.container{width:49rem}.col-sm,.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-sm-offset-0,.col-sm-offset-1,.col-sm-offset-10,.col-sm-offset-11,.col-sm-offset-12,.col-sm-offset-2,.col-sm-offset-3,.col-sm-offset-4,.col-sm-offset-5,.col-sm-offset-6,.col-sm-offset-7,.col-sm-offset-8,.col-sm-offset-9{box-sizing:border-box;-webkit-box-flex:0;-ms-flex:0 0 auto;flex:none;padding-right:.5rem;padding-left:.5rem}.col-sm{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-preferred-size:0;flex-basis:0;max-width:100%}.col-sm-1{-ms-flex-preferred-size:8.33333333%;flex-basis:8.33333333%;max-width:8.33333333%}.col-sm-2{-ms-flex-preferred-size:16.66666667%;flex-basis:16.66666667%;max-width:16.66666667%}.col-sm-3{-ms-flex-preferred-size:25%;flex-basis:25%;max-width:25%}.col-sm-4{-ms-flex-preferred-size:33.33333333%;flex-basis:33.33333333%;max-width:33.33333333%}.col-sm-5{-ms-flex-preferred-size:41.66666667%;flex-basis:41.66666667%;max-width:41.66666667%}.col-sm-6{-ms-flex-preferred-size:50%;flex-basis:50%;max-width:50%}.col-sm-7{-ms-flex-preferred-size:58.33333333%;flex-basis:58.33333333%;max-width:58.33333333%}.col-sm-8{-ms-flex-preferred-size:66.66666667%;flex-basis:66.66666667%;max-width:66.66666667%}.col-sm-9{-ms-flex-preferred-size:75%;flex-basis:75%;max-width:75%}.col-sm-10{-ms-flex-preferred-size:83.33333333%;flex-basis:83.33333333%;max-width:83.33333333%}.col-sm-11{-ms-flex-preferred-size:91.66666667%;flex-basis:91.66666667%;max-width:91.66666667%}.col-sm-12{-ms-flex-preferred-size:100%;flex-basis:100%;max-width:100%}.col-sm-offset-0{margin-left:0}.col-sm-offset-1{margin-left:8.33333333%}.col-sm-offset-2{margin-left:16.66666667%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-4{margin-left:33.33333333%}.col-sm-offset-5{margin-left:41.66666667%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-7{margin-left:58.33333333%}.col-sm-offset-8{margin-left:66.66666667%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-10{margin-left:83.33333333%}.col-sm-offset-11{margin-left:91.66666667%}.start-sm{-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;text-align:start}.center-sm{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;text-align:center}.end-sm{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;text-align:end}.top-sm{-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start}.middle-sm{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.bottom-sm{-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end}.around-sm{-ms-flex-pack:distribute;justify-content:space-around}.between-sm{-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.first-sm{-webkit-box-ordinal-group:0;-ms-flex-order:-1;order:-1}.last-sm{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}}@media only screen and (min-width:64em){.container{width:65rem}.col-md,.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-md-offset-0,.col-md-offset-1,.col-md-offset-10,.col-md-offset-11,.col-md-offset-12,.col-md-offset-2,.col-md-offset-3,.col-md-offset-4,.col-md-offset-5,.col-md-offset-6,.col-md-offset-7,.col-md-offset-8,.col-md-offset-9{box-sizing:border-box;-webkit-box-flex:0;-ms-flex:0 0 auto;flex:none;padding-right:.5rem;padding-left:.5rem}.col-md{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-preferred-size:0;flex-basis:0;max-width:100%}.col-md-1{-ms-flex-preferred-size:8.33333333%;flex-basis:8.33333333%;max-width:8.33333333%}.col-md-2{-ms-flex-preferred-size:16.66666667%;flex-basis:16.66666667%;max-width:16.66666667%}.col-md-3{-ms-flex-preferred-size:25%;flex-basis:25%;max-width:25%}.col-md-4{-ms-flex-preferred-size:33.33333333%;flex-basis:33.33333333%;max-width:33.33333333%}.col-md-5{-ms-flex-preferred-size:41.66666667%;flex-basis:41.66666667%;max-width:41.66666667%}.col-md-6{-ms-flex-preferred-size:50%;flex-basis:50%;max-width:50%}.col-md-7{-ms-flex-preferred-size:58.33333333%;flex-basis:58.33333333%;max-width:58.33333333%}.col-md-8{-ms-flex-preferred-size:66.66666667%;flex-basis:66.66666667%;max-width:66.66666667%}.col-md-9{-ms-flex-preferred-size:75%;flex-basis:75%;max-width:75%}.col-md-10{-ms-flex-preferred-size:83.33333333%;flex-basis:83.33333333%;max-width:83.33333333%}.col-md-11{-ms-flex-preferred-size:91.66666667%;flex-basis:91.66666667%;max-width:91.66666667%}.col-md-12{-ms-flex-preferred-size:100%;flex-basis:100%;max-width:100%}.col-md-offset-0{margin-left:0}.col-md-offset-1{margin-left:8.33333333%}.col-md-offset-2{margin-left:16.66666667%}.col-md-offset-3{margin-left:25%}.col-md-offset-4{margin-left:33.33333333%}.col-md-offset-5{margin-left:41.66666667%}.col-md-offset-6{margin-left:50%}.col-md-offset-7{margin-left:58.33333333%}.col-md-offset-8{margin-left:66.66666667%}.col-md-offset-9{margin-left:75%}.col-md-offset-10{margin-left:83.33333333%}.col-md-offset-11{margin-left:91.66666667%}.start-md{-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;text-align:start}.center-md{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;text-align:center}.end-md{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;text-align:end}.top-md{-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start}.middle-md{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.bottom-md{-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end}.around-md{-ms-flex-pack:distribute;justify-content:space-around}.between-md{-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.first-md{-webkit-box-ordinal-group:0;-ms-flex-order:-1;order:-1}.last-md{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}}@media only screen and (min-width:75em){.container{width:76rem}.col-lg,.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-lg-offset-0,.col-lg-offset-1,.col-lg-offset-10,.col-lg-offset-11,.col-lg-offset-12,.col-lg-offset-2,.col-lg-offset-3,.col-lg-offset-4,.col-lg-offset-5,.col-lg-offset-6,.col-lg-offset-7,.col-lg-offset-8,.col-lg-offset-9{box-sizing:border-box;-webkit-box-flex:0;-ms-flex:0 0 auto;flex:none;padding-right:.5rem;padding-left:.5rem}.col-lg{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-preferred-size:0;flex-basis:0;max-width:100%}.col-lg-1{-ms-flex-preferred-size:8.33333333%;flex-basis:8.33333333%;max-width:8.33333333%}.col-lg-2{-ms-flex-preferred-size:16.66666667%;flex-basis:16.66666667%;max-width:16.66666667%}.col-lg-3{-ms-flex-preferred-size:25%;flex-basis:25%;max-width:25%}.col-lg-4{-ms-flex-preferred-size:33.33333333%;flex-basis:33.33333333%;max-width:33.33333333%}.col-lg-5{-ms-flex-preferred-size:41.66666667%;flex-basis:41.66666667%;max-width:41.66666667%}.col-lg-6{-ms-flex-preferred-size:50%;flex-basis:50%;max-width:50%}.col-lg-7{-ms-flex-preferred-size:58.33333333%;flex-basis:58.33333333%;max-width:58.33333333%}.col-lg-8{-ms-flex-preferred-size:66.66666667%;flex-basis:66.66666667%;max-width:66.66666667%}.col-lg-9{-ms-flex-preferred-size:75%;flex-basis:75%;max-width:75%}.col-lg-10{-ms-flex-preferred-size:83.33333333%;flex-basis:83.33333333%;max-width:83.33333333%}.col-lg-11{-ms-flex-preferred-size:91.66666667%;flex-basis:91.66666667%;max-width:91.66666667%}.col-lg-12{-ms-flex-preferred-size:100%;flex-basis:100%;max-width:100%}.col-lg-offset-0{margin-left:0}.col-lg-offset-1{margin-left:8.33333333%}.col-lg-offset-2{margin-left:16.66666667%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-4{margin-left:33.33333333%}.col-lg-offset-5{margin-left:41.66666667%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-7{margin-left:58.33333333%}.col-lg-offset-8{margin-left:66.66666667%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-10{margin-left:83.33333333%}.col-lg-offset-11{margin-left:91.66666667%}.start-lg{-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;text-align:start}.center-lg{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;text-align:center}.end-lg{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;text-align:end}.top-lg{-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start}.middle-lg{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.bottom-lg{-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end}.around-lg{-ms-flex-pack:distribute;justify-content:space-around}.between-lg{-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.first-lg{-webkit-box-ordinal-group:0;-ms-flex-order:-1;order:-1}.last-lg{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}}</style> + + + + + <link href="/index.xml" rel="alternate" type="application/rss+xml" + title="blog | garhve's hub"> + + <link rel="preconnect" href="https://fonts.gstatic.com"> + <link href="https://fonts.googleapis.com/css?family=Bree+Serif|Bungee+Shade" rel="stylesheet"> + + + +</head> + + +<body> + <article class="post English" id="article"> + <div class="row"> + <div class="col-xs-12"> + <div class="site-header"> + +<header> + <div class="header-title"> + <a href="/" + >Garhve</a + > + </div> + <div class="header-subtitle"></div> +</header> +<div class="row end-md center-xs header-items"> +</div> +<div class="row end-xs"> + + <div class="lang-switch col-xs-3 col-xs-offset-9"> + <a href="/cn/">Chinese</a> + </div> + +</div> +<div class="header-line"></div> + + </div> + <header class="post-header"> + <h1 class="post-title">Past Is Great</h1> + + <div class="row post-desc"> + <div class="col-xs-6"> + + <time class="post-date" datetime="2022-11-07 09:16:15 CST"> + 07 Nov 2022 + </time> + + </div> + <div class="col-xs-6"> + + <div class="post-author"> + <a target="_blank" href="https://garhve.com">@garhve</a> + </div> + + </div> + </div> + + </header> + + <div class="post-content markdown-body"> + + <p>Lately, there’s a sign has been keeping jumping out in front of my eyes. That the past is great!</p> +<p>First is in the movie Midnight in Paris, directed by Woody Allen, which I just finished a week ago. It tells a story of how a screen writer love 20th century because his loving artists all living in it. Though he finally realize that he loves past because the present is imperfect.</p> +<p>Second is my YouTube keeps suggesting songs that got me reminiscence bump. Such songs that remind me when the time power cut is regular and the phone has not yet existed. I still remember the feel when I am wrapped in quilt and watch TV in the cold night… dizzy.</p> +<p>Third just happened now, I was gonna start watching Doraemon, and the title of the episode I’m getting at is ‘Past is Great’, seriously???</p> +<p>even two of them would tell me the present is better than past, I still miss past. Midnight in Paris said we love past because present unsatisfied. And ‘Past in Great’ shows us comparing of ancient and modern lives style. Both views are most people miss about past, either think their life sucks or just wanna experience life in past.</p> +<p>Well, I’m not both… I miss past is that it is fixed, it is unchangeable. No matter what we do now, past is past, it right there, waiting to be read. this feel just like when I watch shows or movies. I’d want to know what ending it will be, and release my imagination along with shows to get that result.</p> +<p>Same thing happens here. Few scenes I remember, or the music I think familiar, but I don’t know when or where I experienced it, I would start my imagination. Maybe I was doing something funny, maybe I was going to somewhere nice, maybe… maybe… then, I got here. The beauty part is, I always thought nice thing, and it always make me feel ease. That’s good enough for me.</p> +<p>I said there’s this sign… Actually, not really. Just some shit things happend recently that make me want to run away. The ‘sign’ just is what I want to see now, not that it really a sign.</p> + + </div> + + <div class="row"> + <div class="col-xs-12"> + + </div> + </div> + + + <div style="height: 50px;"></div> + + + <div class="site-footer"> + + + +</div> + + </div> + </div> + </article> + + + +<script> + + + + + +</script> + + + +</body> + +</html> diff --git a/posts/index.html b/posts/index.html index 51d8a13..30b6e23 100644 --- a/posts/index.html +++ b/posts/index.html @@ -29,8 +29,8 @@ "accountablePerson" : "garhve", "copyrightHolder" : "garhve", "copyrightYear" : "2022", - "datePublished": "2022-09-03 14:33:37 \u002b0800 CST", - "dateModified" : "2022-09-03 14:33:37 \u002b0800 CST", + "datePublished": "2022-11-07 09:16:15 \u002b0800 CST", + "dateModified" : "2022-11-07 09:16:15 \u002b0800 CST", "url" : "https:\/\/blog.garhve.com\/posts\/", "keywords" : [ ] } @@ -97,6 +97,45 @@ <div class="row posts-line"> <div class="posts-date col-xs-2"> + <time datetime="2022-11-07 09:16:15 CST">Nov 07</time> + </div> + <div class="posts-title col-xs-10"> + <div class="row"> + <div class="col-xs-12"> + <a href="/posts/7/">Past Is Great</a> + </div> + </div> + </div> + </div> + + <div class="row posts-line"> + <div class="posts-date col-xs-2"> + <time datetime="2022-09-29 09:43:02 CST">Sep 29</time> + </div> + <div class="posts-title col-xs-10"> + <div class="row"> + <div class="col-xs-12"> + <a href="/posts/6/">Mess with Bash(2)</a> + </div> + </div> + </div> + </div> + + <div class="row posts-line"> + <div class="posts-date col-xs-2"> + <time datetime="2022-09-12 09:02:06 CST">Sep 12</time> + </div> + <div class="posts-title col-xs-10"> + <div class="row"> + <div class="col-xs-12"> + <a href="/posts/5/">Escape Sequences</a> + </div> + </div> + </div> + </div> + + <div class="row posts-line"> + <div class="posts-date col-xs-2"> <time datetime="2022-09-03 14:33:37 CST">Sep 03</time> </div> <div class="posts-title col-xs-10"> diff --git a/posts/index.xml b/posts/index.xml index 675d18e..7c1d263 100644 --- a/posts/index.xml +++ b/posts/index.xml @@ -6,7 +6,43 @@ <description>Recent content in Posts on blog | garhve's hub</description> <generator>Hugo -- gohugo.io</generator> <language>en-us</language> - <lastBuildDate>Sat, 03 Sep 2022 14:33:37 +0800</lastBuildDate><atom:link href="https://blog.garhve.com/posts/index.xml" rel="self" type="application/rss+xml" /> + <lastBuildDate>Mon, 07 Nov 2022 09:16:15 +0800</lastBuildDate><atom:link href="https://blog.garhve.com/posts/index.xml" rel="self" type="application/rss+xml" /> + <item> + <title>Past Is Great</title> + <link>https://blog.garhve.com/posts/7/</link> + <pubDate>Mon, 07 Nov 2022 09:16:15 +0800</pubDate> + + <guid>https://blog.garhve.com/posts/7/</guid> + <description>Lately, there’s a sign has been keeping jumping out in front of my eyes. That the past is great! +First is in the movie Midnight in Paris, directed by Woody Allen, which I just finished a week ago. It tells a story of how a screen writer love 20th century because his loving artists all living in it. Though he finally realize that he loves past because the present is imperfect.</description> + </item> + + <item> + <title>Mess with Bash(2)</title> + <link>https://blog.garhve.com/posts/6/</link> + <pubDate>Thu, 29 Sep 2022 09:43:02 +0800</pubDate> + + <guid>https://blog.garhve.com/posts/6/</guid> + <description>More info is in this tutorial +all value expansions (ie. all syntax with a $ prefix) can only expand inside quoted arguments if the argument was double-quoted . Single quotes will turn the dollar-syntax into literal characters, causing bash to output the dollar rather than expand its value in-place! +&ldquo;Value expansions ($...) must always be double-quoted.&rdquo; +Never leave a value expansion unquoted. +Redirection File Redirection 0 is standard input, 1 is standard output, 2 is standard error</description> + </item> + + <item> + <title>Escape Sequences</title> + <link>https://blog.garhve.com/posts/5/</link> + <pubDate>Mon, 12 Sep 2022 09:02:06 +0800</pubDate> + + <guid>https://blog.garhve.com/posts/5/</guid> + <description>copied from github in case one day it disappears +more information could visit vt100 User Guide +ANSI Escape Sequences Standard escape codes are prefixed with Escape: +Ctrl-Key: ^[ Octal: \033 Unicode: \u001b Hexadecimal: \x1B Decimal: 27 Followed by the command, somtimes delimited by opening square bracket ([), known as a Control Sequence Introducer (CSI), optionally followed by arguments and the command itself. +Arguments are delimeted by semi colon (;).</description> + </item> + <item> <title>Architecture of Linux Kernel</title> <link>https://blog.garhve.com/posts/4/</link> diff --git a/sitemap.xml b/sitemap.xml index e37d9a1..4a47db1 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -4,7 +4,7 @@ <sitemap> <loc>https://blog.garhve.com/en/sitemap.xml</loc> - <lastmod>2022-09-03T14:33:37+08:00</lastmod> + <lastmod>2022-11-07T09:16:15+08:00</lastmod> </sitemap> |