Not to be confused with the redo build system[0]<p>[0] <a href="https://redo.readthedocs.io/en/latest/" rel="nofollow">https://redo.readthedocs.io/en/latest/</a>
FWIW the title says "functions", but it apparently uses aliases.<p>Shell functions have all the same functionality as aliases and they'll catch more syntax errors upon "source myscript". Example:<p><pre><code> ls() {
command ls --color=auto "$@"
}
</code></pre>
is equivalent to<p><pre><code> alias ls='ls --color=auto'
</code></pre>
but IMO less error prone. You also get syntax highlighting.<p>The only tricky thing is to remember the 'command' prefix if the "alias" has the same name as the command. Otherwise you'll get an infinite loop of the function trying to call itself!
Currently, I'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'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.
I use this <a href="https://github.com/erichs/composure" rel="nofollow">https://github.com/erichs/composure</a> which seems to do more.
I do this whenever working on terminal.<p>The mnemonic is erc=edit rc, src=source rc.<p>alias erc="vim ~/.bash_aliases"
alias src="source ~/.bash_aliases"<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.
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://blag.felixhummel.de/basics/bash/wrapper-scripts.html" rel="nofollow">https://blag.felixhummel.de/basics/bash/wrapper-scripts.html</a>
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.