-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
62 changed files
with
144 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<!doctype html><html lang=en-US><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><link rel="shortcut icon" href=https://biscuits.panda-gopher.ts.net/favicon.ico><title>Bash `while` loops | ||
<!doctype html><html lang=en-US><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><link rel="shortcut icon" href=https://blog.andylu.dev/favicon.ico><title>Bash `while` loops | ||
| | ||
Andy's Cafe | ||
</title><meta name=title content="Bash `while` loops"><meta name=description content='Here’s a bash snippet I can see myself using one day | ||
while :; do ls -lh "$( ls -t1 /tmp/tmp* | head -n 1 )"; sleep 10; done "$( ls -t1 /tmp/tmp* | head -n 1 )": Get a file name ls -t1 /tmp/tmp*: List the files in /tmp/tmp* ordered by most recently updated head -n 1: Get the first one ls -lh <one-file>: Get the long listing of just one file The rest of it is just to do it over and over so that I can see changes in the file size '><meta name=keywords content="bash,"><meta name=referrer content="no-referrer-when-downgrade"><link rel=stylesheet href=/css/style.c18fa8acc94c2957cb451d218e77f7e728d427d75517c4f24c14bc2301b0263f.css integrity="sha256-wY+orMlMKVfLRR0hjnf35yjUJ9dVF8TyTBS8IwGwJj8=" crossorigin=anonymous><style>@import "https://cdn.jsdelivr.net/npm/firacode@6.2.0/distr/fira_code.css";html{cursor:url(/aero_arrow.cur),default;font-family:work-sans,sans-serif}header,h1,h2,h3{font-family:gluten,sans-serif}nav,time{font-family:fira code vf,sans-serif}nav{border-radius:var(--pico-border-radius);background-color:var(--pico-mid)}nav>a{--pico-primary:#110F58}nav>ul>li>a:hover{background-color:var(--pico-dark);color:var(--pico-light)}article>header>a>button:hover{background-color:var(--pico-mid)}@supports(font-variation-settings:normal){code{font-family:fira code vf,monospace}}a:hover{animation-duration:.5s;animation-iteration-count:infinite;animation-name:flick}@keyframes flick{from{cursor:url(/aero_link1.ico),auto}to{cursor:url(/aero_link2.ico),auto}}::selection{background-color:var(--pico-text-selection-background-color);color:var(--pico-text-selection-color)}.post-header{display:flex;flex-direction:row;padding:1rem 0}.post-header-text{padding:0 1rem}.post-icon-container{border-radius:10px;display:flex;justify-content:center;align-items:center;width:100px;height:100px;background-color:var(--pico-light)}.button{position:relative;border:4px solid var(--pico-primary);outline:none;border-radius:40px;width:12rem;height:6rem;background:var(--pico-mid);box-shadow:-6px 20px 25px rgba(0,0,0,.2),20px 0 30px #110FA8,6px 10px 15px #110FA8,6px 20px 35px #110FA8;transition:.13s ease-in-out;margin-bottom:1.5rem}.button-content{display:inline-block;position:relative;width:100%;border-radius:40px;box-shadow:inset 0 -8px #110FA8,0 -8px 0 var(--pico-mid);transition:.13s ease-in-out;height:100%}.button-text{margin:0;position:absolute;box-sizing:border-box;transform:translate3d(0,-4px,0);box-shadow:none;padding:2rem;font-family:fira code vf,sans-serif;font-size:.8rem}.button:active{box-shadow:none}.button-content:active{box-shadow:none}.button-text:active{transform:translate3d(0,0,0)}</style><style type=text/css media=screen>@media(prefers-color-scheme:dark){.bg{color:#cad3f5;background-color:#24273a}.chroma{color:#cad3f5;background-color:#24273a}.chroma .x{}.chroma .err{color:#ed8796}.chroma .cl{}.chroma .lnlinks{outline:none;text-decoration:none;color:inherit}.chroma .lntd{vertical-align:top;padding:0;margin:0;border:0}.chroma .lntable{border-spacing:0;padding:0;margin:0;border:0}.chroma .hl{color:#494d64}.chroma .lnt{white-space:pre;-webkit-user-select:none;user-select:none;margin-right:.4em;padding:0 .4em;color:#8087a2}.chroma .ln{white-space:pre;-webkit-user-select:none;user-select:none;margin-right:.4em;padding:0 .4em;color:#8087a2}.chroma .line{display:flex}.chroma .k{color:#c6a0f6}.chroma .kc{color:#f5a97f}.chroma .kd{color:#ed8796}.chroma .kn{color:#8bd5ca}.chroma .kp{color:#c6a0f6}.chroma .kr{color:#c6a0f6}.chroma .kt{color:#ed8796}.chroma .n{}.chroma .na{color:#8aadf4}.chroma .nb{color:#91d7e3}.chroma .bp{color:#91d7e3}.chroma .nc{color:#eed49f}.chroma .no{color:#eed49f}.chroma .nd{color:#8aadf4;font-weight:700}.chroma .ni{color:#8bd5ca}.chroma .ne{color:#f5a97f}.chroma .nf{color:#8aadf4}.chroma .fm{color:#8aadf4}.chroma .nl{color:#91d7e3}.chroma .nn{color:#f5a97f}.chroma .nx{}.chroma .py{color:#f5a97f}.chroma .nt{color:#c6a0f6}.chroma .nv{color:#f4dbd6}.chroma .vc{color:#f4dbd6}.chroma .vg{color:#f4dbd6}.chroma .vi{color:#f4dbd6}.chroma .vm{color:#f4dbd6}.chroma .l{}.chroma .ld{}.chroma .s{color:#a6da95}.chroma .sa{color:#ed8796}.chroma .sb{color:#a6da95}.chroma .sc{color:#a6da95}.chroma .dl{color:#8aadf4}.chroma .sd{color:#6e738d}.chroma .s2{color:#a6da95}.chroma .se{color:#8aadf4}.chroma .sh{color:#6e738d}.chroma .si{color:#a6da95}.chroma .sx{color:#a6da95}.chroma .sr{color:#8bd5ca}.chroma .s1{color:#a6da95}.chroma .ss{color:#a6da95}.chroma .m{color:#f5a97f}.chroma .mb{color:#f5a97f}.chroma .mf{color:#f5a97f}.chroma .mh{color:#f5a97f}.chroma .mi{color:#f5a97f}.chroma .il{color:#f5a97f}.chroma .mo{color:#f5a97f}.chroma .o{color:#91d7e3;font-weight:700}.chroma .ow{color:#91d7e3;font-weight:700}.chroma .p{}.chroma .c{color:#6e738d;font-style:italic}.chroma .ch{color:#6e738d;font-style:italic}.chroma .cm{color:#6e738d;font-style:italic}.chroma .c1{color:#6e738d;font-style:italic}.chroma .cs{color:#6e738d;font-style:italic}.chroma .cp{color:#6e738d;font-style:italic}.chroma .cpf{color:#6e738d;font-weight:700;font-style:italic}.chroma .g{}.chroma .gd{color:#ed8796;background-color:#363a4f}.chroma .ge{font-style:italic}.chroma .gr{color:#ed8796}.chroma .gh{color:#f5a97f;font-weight:700}.chroma .gi{color:#a6da95;background-color:#363a4f}.chroma .go{}.chroma .gp{}.chroma .gs{font-weight:700}.chroma .gu{color:#f5a97f;font-weight:700}.chroma .gt{color:#ed8796}.chroma .gl{text-decoration:underline}.chroma .w{}}@media(prefers-color-scheme:light){.bg{color:#4c4f69;background-color:#eff1f5}.chroma{color:#4c4f69;background-color:#eff1f5}.chroma .x{}.chroma .err{color:#d20f39}.chroma .cl{}.chroma .lnlinks{outline:none;text-decoration:none;color:inherit}.chroma .lntd{vertical-align:top;padding:0;margin:0;border:0}.chroma .lntable{border-spacing:0;padding:0;margin:0;border:0}.chroma .hl{color:#bcc0cc}.chroma .lnt{white-space:pre;-webkit-user-select:none;user-select:none;margin-right:.4em;padding:0 .4em;color:#8c8fa1}.chroma .ln{white-space:pre;-webkit-user-select:none;user-select:none;margin-right:.4em;padding:0 .4em;color:#8c8fa1}.chroma .line{display:flex}.chroma .k{color:#8839ef}.chroma .kc{color:#fe640b}.chroma .kd{color:#d20f39}.chroma .kn{color:#179299}.chroma .kp{color:#8839ef}.chroma .kr{color:#8839ef}.chroma .kt{color:#d20f39}.chroma .n{}.chroma .na{color:#1e66f5}.chroma .nb{color:#04a5e5}.chroma .bp{color:#04a5e5}.chroma .nc{color:#df8e1d}.chroma .no{color:#df8e1d}.chroma .nd{color:#1e66f5;font-weight:700}.chroma .ni{color:#179299}.chroma .ne{color:#fe640b}.chroma .nf{color:#1e66f5}.chroma .fm{color:#1e66f5}.chroma .nl{color:#04a5e5}.chroma .nn{color:#fe640b}.chroma .nx{}.chroma .py{color:#fe640b}.chroma .nt{color:#8839ef}.chroma .nv{color:#dc8a78}.chroma .vc{color:#dc8a78}.chroma .vg{color:#dc8a78}.chroma .vi{color:#dc8a78}.chroma .vm{color:#dc8a78}.chroma .l{}.chroma .ld{}.chroma .s{color:#40a02b}.chroma .sa{color:#d20f39}.chroma .sb{color:#40a02b}.chroma .sc{color:#40a02b}.chroma .dl{color:#1e66f5}.chroma .sd{color:#9ca0b0}.chroma .s2{color:#40a02b}.chroma .se{color:#1e66f5}.chroma .sh{color:#9ca0b0}.chroma .si{color:#40a02b}.chroma .sx{color:#40a02b}.chroma .sr{color:#179299}.chroma .s1{color:#40a02b}.chroma .ss{color:#40a02b}.chroma .m{color:#fe640b}.chroma .mb{color:#fe640b}.chroma .mf{color:#fe640b}.chroma .mh{color:#fe640b}.chroma .mi{color:#fe640b}.chroma .il{color:#fe640b}.chroma .mo{color:#fe640b}.chroma .o{color:#04a5e5;font-weight:700}.chroma .ow{color:#04a5e5;font-weight:700}.chroma .p{}.chroma .c{color:#9ca0b0;font-style:italic}.chroma .ch{color:#9ca0b0;font-style:italic}.chroma .cm{color:#9ca0b0;font-style:italic}.chroma .c1{color:#9ca0b0;font-style:italic}.chroma .cs{color:#9ca0b0;font-style:italic}.chroma .cp{color:#9ca0b0;font-style:italic}.chroma .cpf{color:#9ca0b0;font-weight:700;font-style:italic}.chroma .g{}.chroma .gd{color:#d20f39;background-color:#ccd0da}.chroma .ge{font-style:italic}.chroma .gr{color:#d20f39}.chroma .gh{color:#fe640b;font-weight:700}.chroma .gi{color:#40a02b;background-color:#ccd0da}.chroma .go{}.chroma .gp{}.chroma .gs{font-weight:700}.chroma .gu{color:#fe640b;font-weight:700}.chroma .gt{color:#d20f39}.chroma .gl{text-decoration:underline}.chroma .w{}}</style><link rel=preconnect href=https://fonts.bunny.net><link href="https://fonts.bunny.net/css?family=fira-code:400|merriweather-sans:400" rel=stylesheet><link href="https://fonts.bunny.net/css?family=gluten:700|work-sans:400" rel=stylesheet><link rel=webmention href=https://webmention.io/andylu.dev/webmention></head><body><header><h1><a href=/ class=title>Andy's Cafe</a></h1><nav><ul style=width:100%;justify-content:space-around><li><a href=/>Home</a></li><li><a href=/about/>About</a></li><li><a href=/now/>Now</a></li><li><a href=/cortado/>Cortado</a></li><li><a href=/cappucchino/>Cappuccino</a></li><li><a href=/latte/>Latte</a></li></ul></nav></header><main><div class=post-header><div class=post-icon-container><img src=/images/Cappuccino-ALU-Assets_huc02586a4efbdbc958f6df8ebff1e094c_23393_0x50_resize_box_3.png></div><div class=post-header-text><h1><a href=/cappucchino/bash-while-loops/>Bash `while` loops</a></h1><p><strong>Last updated </strong>: | ||
<time datetime=2023-11-27 pubdate>2023-11-27T15:54:59-05:00</time></p></div></div><article class=post><p>Here’s a bash snippet I can see myself using one day</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#66d9ef>while</span> :; <span style=color:#66d9ef>do</span> ls -lh <span style=color:#e6db74>"</span><span style=color:#66d9ef>$(</span> ls -t1 /tmp/tmp* | head -n <span style=color:#ae81ff>1</span> <span style=color:#66d9ef>)</span><span style=color:#e6db74>"</span>; sleep 10; <span style=color:#66d9ef>done</span> | ||
</span></span></code></pre></div><ul><li><code>"$( ls -t1 /tmp/tmp* | head -n 1 )"</code>: Get a file name<ul><li><code>ls -t1 /tmp/tmp*</code>: List the files in <code>/tmp/tmp*</code> ordered by most recently updated</li><li><code>head -n 1</code>: Get the first one</li></ul></li><li><code>ls -lh <one-file></code>: Get the long listing of just one file</li><li>The rest of it is just to do it over and over so that I can see changes in the file size</li></ul></article><div class=button><a href=mailto:fuzzy.sand8027@fastmail.com target=_blank class=button-content><p class=button-text>Reply via email</p></a></div><p><a href=https://biscuits.panda-gopher.ts.net/tags/bash/>#Bash | ||
</span></span></code></pre></div><ul><li><code>"$( ls -t1 /tmp/tmp* | head -n 1 )"</code>: Get a file name<ul><li><code>ls -t1 /tmp/tmp*</code>: List the files in <code>/tmp/tmp*</code> ordered by most recently updated</li><li><code>head -n 1</code>: Get the first one</li></ul></li><li><code>ls -lh <one-file></code>: Get the long listing of just one file</li><li>The rest of it is just to do it over and over so that I can see changes in the file size</li></ul></article><div class=button><a href=mailto:fuzzy.sand8027@fastmail.com target=_blank class=button-content><p class=button-text>Reply via email</p></a></div><p><a href=https://blog.andylu.dev/tags/bash/>#Bash | ||
</a> </p></main><footer></footer></body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.