Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The canonical answer is to create scripts containing these commands.</p> <p><strong>Edit</strong> Supposing you have the following history entries;</p> <pre><code>find /var/www -name '*.html' -exec fgrep '&lt;title&gt;' {} /dev/null \; find ~/public_html -name '*.php' -exec fgrep include {} /dev/null \; </code></pre> <p>... you can try to isolate the parameters into a function something like this;</p> <pre><code>r () { find "$1" -name "*.$2" -exec fgrep "$3" {} /dev/null \; } </code></pre> <p>... which you could use like this, to repeat the history entries from above:</p> <pre><code>r /var/www html '&lt;title&gt;' r ~/public_html php include </code></pre> <p>Obviously, the step is then not very long to create a proper script with defaults, parameter validation, etc. (Hint: you could usefully default to the current directory for the path, and no extension for the file name, and add options like <code>--path</code> and <code>--ext</code> to override the defaults when you want to; then there will be only one mandatory argument to the script.)</p> <p>Typically, you would store the script in <code>$HOME/bin</code> and make sure this directory is added to your <code>PATH</code> from your <code>.profile</code> or similar. For functions, these are usually defined in <code>.profile</code>, or a separate file which is <code>source</code>d from this file.</p> <p>Having it in a central place also helps develop it further; for example, for precision and perhaps some minor added efficiency, you might want to add <code>-type f</code> to the <code>find</code> command; now there is only one place to remember to edit, and you will have it fixed for good.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload