TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Practical Shell Patterns I Use

17 pointsby oedmarapover 3 years ago

3 comments

marginalia_nuover 3 years ago
The last example<p><pre><code> $ kubectl apply -f &lt;(cat &lt;&lt; EOF … EOF ) </code></pre> can be written<p><pre><code> $ kubectl apply -f- &lt;&lt;EOF # ... </code></pre> Piping from cat is a pretty big red flag that you are doing whatever you are doing in a roundabout way.
评论 #29812582 未加载
tsujpover 3 years ago
There&#x27;s also these resources for more vetted patterns:<p>(1) Bash: <a href="https:&#x2F;&#x2F;github.com&#x2F;dylanaraps&#x2F;pure-bash-bible" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dylanaraps&#x2F;pure-bash-bible</a><p>(2) POSIX Shell: <a href="https:&#x2F;&#x2F;github.com&#x2F;dylanaraps&#x2F;pure-sh-bible" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dylanaraps&#x2F;pure-sh-bible</a>
oweilerover 3 years ago
For killing matching processes I prefer killall or pkill.<p>For infinite loops I prefer the slightly faster<p>while :; do # do sth done