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.

Show HN: Redo – Command line utility for quickly creating shell functions

124 pointsby silentprogabout 3 years ago

10 comments

Crespylabout 3 years ago
Not to be confused with the redo build system[0]<p>[0] <a href="https:&#x2F;&#x2F;redo.readthedocs.io&#x2F;en&#x2F;latest&#x2F;" rel="nofollow">https:&#x2F;&#x2F;redo.readthedocs.io&#x2F;en&#x2F;latest&#x2F;</a>
chubotabout 3 years ago
FWIW the title says &quot;functions&quot;, but it apparently uses aliases.<p>Shell functions have all the same functionality as aliases and they&#x27;ll catch more syntax errors upon &quot;source myscript&quot;. Example:<p><pre><code> ls() { command ls --color=auto &quot;$@&quot; } </code></pre> is equivalent to<p><pre><code> alias ls=&#x27;ls --color=auto&#x27; </code></pre> but IMO less error prone. You also get syntax highlighting.<p>The only tricky thing is to remember the &#x27;command&#x27; prefix if the &quot;alias&quot; has the same name as the command. Otherwise you&#x27;ll get an infinite loop of the function trying to call itself!
评论 #30884303 未加载
评论 #30886508 未加载
评论 #30885725 未加载
buu700about 3 years ago
Currently, I&#x27;ll append a comment to a frequently used command for easy searching from my history. For a simple example, I can access `git diff -w ; git diff -w --cached # gitdiff` by pressing Ctrl+R and typing `# gitd`.<p>For commands I use frequently or that are clunky to maintain as one-liners, I&#x27;ll convert them into functions in my bashrc.<p>This seems like the best of both worlds in many ways, or at least is a great third option to have.
评论 #30881561 未加载
评论 #30880270 未加载
评论 #30880781 未加载
junkblockerabout 3 years ago
I use this <a href="https:&#x2F;&#x2F;github.com&#x2F;erichs&#x2F;composure" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;erichs&#x2F;composure</a> which seems to do more.
stevenhuangabout 3 years ago
I do this whenever working on terminal.<p>The mnemonic is erc=edit rc, src=source rc.<p>alias erc=&quot;vim ~&#x2F;.bash_aliases&quot; alias src=&quot;source ~&#x2F;.bash_aliases&quot;<p>Whenever I need to add or modify some shell function or alias (or even make a quick note) I type erc to open the alias file. Then I type src to load it. Very handy.
评论 #30886230 未加载
felixhummelabout 3 years ago
My workflow looks like this:<p>hack hack, then run<p><pre><code> nuscript-bash something </code></pre> Hit C-x C-h, select some lines, edit, then run<p><pre><code> something </code></pre> To do maintenance:<p><pre><code> edcom something </code></pre> I wrote a little more about it here: <a href="https:&#x2F;&#x2F;blag.felixhummel.de&#x2F;basics&#x2F;bash&#x2F;wrapper-scripts.html" rel="nofollow">https:&#x2F;&#x2F;blag.felixhummel.de&#x2F;basics&#x2F;bash&#x2F;wrapper-scripts.html</a>
opanabout 3 years ago
This looks very cool. I use shell aliases heavily on all my devices and try to avoid typing out the same one-liners more than once or twice when possible.
评论 #30879643 未加载
unixheroabout 3 years ago
This reminds me of what I had in 1995 with the 4DOS.COM command interpreter (command.com replacement).
replwoacauseabout 3 years ago
Love it! I am going to start using it immediately.
qorrectabout 3 years ago
Very cool