Define function in unix/linux command line (e.g. BASH) : <p>Sometimes I have a one-liner that I am repeating many times for a particular task, but will likely never use again in the exact same form. It includes a file name that I am pasting in from a directory listing. Somewhere in between  and creating a bash script I thought maybe I could just create a one-liner function at the command line like:</p>

<pre><code>numresults(){ ls "$1"/RealignerTargetCreator | wc -l }
</code></pre>

<p>I've tried a few things like using eval, using <code>numresults=function...</code>, but haven't stumbled on the right syntax, and haven't found anything on the web so far. (Everything coming up is just tutorials on bash functions).</p>
