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.

Using hashtags to organize your bash history

53 pointsby vigneshv_psgalmost 12 years ago

7 comments

mooism2almost 12 years ago
Or you could stick the command in a shell script.<p><pre><code> #!&#x2F;bin&#x2F;sh find . -iname &#x27;*.php&#x27; -print0 | xargs -0 -n1 php -l </code></pre> Save it to ~&#x2F;bin&#x2F;phplint (you do have ~&#x2F;bin in your PATH, right?), chmod +x it, check it in, and you have a new phplint command. No need to mess about with hashtags in your shell history.<p>Am I missing something?
评论 #5965853 未加载
评论 #5965225 未加载
评论 #5965557 未加载
评论 #5966692 未加载
pyrealmost 12 years ago
The phplint example isn&#x27;t a great one. If you use phplint enough you should either:<p>1) Create a generic shell script as others have stated.<p>2) Create a Makefile for your projects with a &#x27;lint&#x27; target. If you create many different PHP projects, consider a project template directory with a Makefile that already has this, so that every new project automatically has the functionality:<p><pre><code> make lint </code></pre> This idea has been around though. I can&#x27;t recall if I&#x27;ve seen tagging used before, but saving an unexecuted commandline in the shell history by commenting it out is another useful hack that&#x27;s been around a while.
评论 #5966037 未加载
thejsjunkyalmost 12 years ago
For stuff like the example where you know you will be reusing the command, it&#x27;s better to use an alias or script. Even if it&#x27;s just a command you plan to run in a couple times in a row you can add a temporay alias with: alias foo = &quot;!!&quot; - that way you don&#x27;t have to hit ctrl+r each time.<p>Still, it&#x27;s a good tip in terms of adding comments to unusual&#x2F;confusing commands so when you go through your history you&#x27;re not like &quot;wtf was I doing here?&quot; or if you unexpectedly need to recall it.
catenatealmost 12 years ago
This response explains how I use Acme to store (and later modify) commands in files in each directory.<p><a href="https://news.ycombinator.com/item?id=5566567" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=5566567</a><p>In addition, I wrote a generic tag-indexing tool (in Plan 9&#x27;s rc and Inferno&#x27;s sh) to find random bits of information (including commands) without caring where they live in my file hierarchy.<p><a href="https://github.com/catenate/notabene" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;catenate&#x2F;notabene</a><p><a href="http://swtools.wordpress.com/2010/03/05/nb%E2%80%94search-and-index-notes-in-files-by-keyword/" rel="nofollow">http:&#x2F;&#x2F;swtools.wordpress.com&#x2F;2010&#x2F;03&#x2F;05&#x2F;nb%E2%80%94search-an...</a>
thedeeralmost 12 years ago
This is neat! I appreciate using something like hashtags in an unexpected, but useful way. And as for the comments saying the example should just be put in a shell script, that&#x27;s not really relevant at all. The article has nothing to do with the merits of simple shell scripts versus a fun and useful hack.
portmanteaufualmost 12 years ago
hee hee, &quot;bashtags.&quot;
twicalmost 12 years ago
This is a cute hack.