File: fish.html

package info (click to toggle)
fish 4.2.1-3.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 35,976 kB
  • sloc: python: 6,972; javascript: 1,407; sh: 1,009; xml: 411; ansic: 230; objc: 78; makefile: 20
file content (320 lines) | stat: -rw-r--r-- 20,310 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
<!DOCTYPE html>

<html lang="en" data-content_root="../">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />

    <title>fish - the friendly interactive shell &#8212; fish-shell 4.2.1 documentation</title>
    <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=4da8bbd6" />
    <link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css?v=f89b4716" />
    <script src="../_static/documentation_options.js?v=6fb65176"></script>
    <script src="../_static/doctools.js?v=9bcbadda"></script>
    <script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="fish_add_path - add to the path" href="fish_add_path.html" />
    <link rel="prev" title="fg - bring job to foreground" href="fg.html" />
    <link rel="shortcut icon" type="image/png" href="../_static/fish.png" />
     

  </head><body><div id="fmain">  
    <div class="related" role="navigation" aria-label="Related">
      <h3>Navigation</h3>
      <ul>
    <li><img src="../_static/fish.png" alt=""
             style="width: 80px; height: 80px; vertical-align: middle; margin-top: -1px"/></li>
    <li><a href="https://fishshell.com/">fish-shell</a> &#187;</li>
    
    <a href="../index.html">fish-shell 4.2.1 documentation</a> &#187;
    

          <li class="nav-item nav-item-1"><a href="../commands.html" accesskey="U">Commands</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">fish - the friendly interactive shell</a></li>
    <li class="right">
        

    <div class="inline-search" role="search">
        <form class="inline-search" action="../search.html" method="get">
          <input placeholder="Quick search" type="text" name="q" />
          <input type="submit" value="Go" />
          <input type="hidden" name="check_keywords" value="yes" />
          <input type="hidden" name="area" value="default" />
        </form>
    </div>
    </li>
    
    <div id="old-docs-notice" style="display: none">
        This documents an old version of fish.
        <a href="../../current/">See the latest release.</a>
    </div>

      </ul>
    </div>    

    <div class="document">
      <div class="sphinxsidebar" role="navigation" aria-label="Main">
        <div class="sphinxsidebarwrapper">
<div>
<h3><a href="../index.html">Documents</a></h3>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../index.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="../faq.html">Frequently asked questions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../interactive.html">Interactive use</a></li>
<li class="toctree-l1"><a class="reference internal" href="../language.html">The fish language</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../commands.html">Commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="../fish_for_bash_users.html">Fish for bash users</a></li>
<li class="toctree-l1"><a class="reference internal" href="../tutorial.html">Tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="../completions.html">Writing your own completions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../prompt.html">Writing your own prompt</a></li>
<li class="toctree-l1"><a class="reference internal" href="../design.html">Design</a></li>
<li class="toctree-l1"><a class="reference internal" href="../relnotes.html">Release notes</a></li>
<li class="toctree-l1"><a class="reference internal" href="../terminal-compatibility.html">Terminal Compatibility</a></li>
<li class="toctree-l1"><a class="reference internal" href="../contributing.html">Contributing To Fish</a></li>
<li class="toctree-l1"><a class="reference internal" href="../license.html">License</a></li>
</ul>

</div>
<search id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>
    </div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>
<div>
<h4><a href="../index.html">Sections</a></h4>
<ul>
<li><a class="reference internal" href="#">fish - the friendly interactive shell</a><ul>
<li><a class="reference internal" href="#synopsis">Synopsis</a></li>
<li><a class="reference internal" href="#description">Description</a></li>
<li><a class="reference internal" href="#debugging">Debugging</a></li>
<li><a class="reference internal" href="#examples">Examples</a></li>
</ul>
</li>
</ul>

</div>
        </div>
      </div>
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <section id="fish-the-friendly-interactive-shell">
<h1>fish - the friendly interactive shell<a class="headerlink" href="#fish-the-friendly-interactive-shell" title="Link to this heading">¶</a></h1>
<section id="synopsis">
<h2>Synopsis<a class="headerlink" href="#synopsis" title="Link to this heading">¶</a></h2>
<div class="highlight-fish-synopsis notranslate"><div class="highlight"><pre><span></span><span class="nf">fish</span><span class="w"> </span><span class="g g-Other">[</span><span class="no">OPTIONS</span><span class="g g-Other">]</span><span class="w"> </span><span class="g g-Other">[</span><span class="no">FILE</span><span class="w"> </span><span class="g g-Other">[</span><span class="no">ARG</span><span class="w"> </span><span class="g g-Other">...]]</span>
<span class="nf">fish</span><span class="w"> </span><span class="g g-Other">[</span><span class="no">OPTIONS</span><span class="g g-Other">]</span><span class="w"> </span><span class="g g-Other">[</span><span class="no">-c</span><span class="w"> </span><span class="no">COMMAND</span><span class="w"> </span><span class="g g-Other">[</span><span class="no">ARG</span><span class="w"> </span><span class="g g-Other">...]]</span>
</pre></div>
</div>
</section>
<section id="description">
<h2>Description<a class="headerlink" href="#description" title="Link to this heading">¶</a></h2>
<p><strong class="command">fish</strong> is a command-line shell written mainly with interactive use in mind.
This page briefly describes the options for invoking <strong class="command">fish</strong>.
The <a class="reference internal" href="../index.html#intro"><span class="std std-ref">full manual</span></a> is available in HTML by using the <strong class="command">help</strong> command from inside fish, and in the <cite>fish-doc(1)</cite> man page.
The <a class="reference internal" href="../tutorial.html"><span class="doc">tutorial</span></a> is available as HTML via <code class="docutils literal notranslate"><span class="pre">help</span> <span class="pre">tutorial</span></code> or in <cite>man fish-tutorial</cite>.</p>
<p>The following options are available:</p>
<dl class="simple">
<dt><strong>-c</strong> or <strong>--command=COMMAND</strong></dt><dd><p>Evaluate the specified commands instead of reading from the commandline.
Any additional positional arguments are used as <code class="docutils literal notranslate"><span class="pre">$argv</span></code>.</p>
</dd>
<dt><strong>-C</strong> or <strong>--init-command=COMMANDS</strong></dt><dd><p>Evaluate specified commands after reading the configuration but before executing command specified by <strong>-c</strong> or reading interactive input.</p>
</dd>
<dt><strong>-d</strong> or <strong>--debug=DEBUG_CATEGORIES</strong></dt><dd><p>Enables debug output and specify a pattern for matching debug categories.
See <a class="reference internal" href="#debugging-fish"><span class="std std-ref">Debugging</span></a> below for details.</p>
</dd>
<dt><strong>-o</strong> or <strong>--debug-output=DEBUG_FILE</strong></dt><dd><p>Specifies a file path to receive the debug output, including categories and <span class="target" id="index-0"></span><a class="reference internal" href="../language.html#envvar-fish_trace"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">fish_trace</span></code></a>.
The default is standard error.</p>
</dd>
<dt><strong>-i</strong> or <strong>--interactive</strong></dt><dd><p>The shell is interactive.</p>
</dd>
<dt><strong>-l</strong> or <strong>--login</strong></dt><dd><p>Act as if invoked as a login shell.</p>
</dd>
<dt><strong>-N</strong> or <strong>--no-config</strong></dt><dd><p>Do not read configuration files.</p>
</dd>
<dt><strong>-n</strong> or <strong>--no-execute</strong></dt><dd><p>Do not execute any commands, only perform syntax checking.</p>
</dd>
<dt><strong>-p</strong> or <strong>--profile=PROFILE_FILE</strong></dt><dd><p>when <strong class="command">fish</strong> exits, output timing information on all executed commands to the specified file.
This excludes time spent starting up and reading the configuration.</p>
</dd>
<dt><strong>--profile-startup=PROFILE_FILE</strong></dt><dd><p>Will write timing for <code class="docutils literal notranslate"><span class="pre">fish</span></code> startup to specified file.</p>
</dd>
<dt><strong>-P</strong> or <strong>--private</strong></dt><dd><p>Enables <a class="reference internal" href="../interactive.html#private-mode"><span class="std std-ref">private mode</span></a>: <strong>fish</strong> will not access old or store new history.</p>
</dd>
<dt><strong>--print-rusage-self</strong></dt><dd><p>When <strong class="command">fish</strong> exits, output stats from getrusage.</p>
</dd>
<dt><strong>--print-debug-categories</strong></dt><dd><p>Print all debug categories, and then exit.</p>
</dd>
<dt><strong>-v</strong> or <strong>--version</strong></dt><dd><p>Print version and exit.</p>
</dd>
<dt><strong>-f</strong> or <strong>--features=FEATURES</strong></dt><dd><p>Enables one or more comma-separated <a class="reference internal" href="../language.html#featureflags"><span class="std std-ref">feature flags</span></a>.</p>
</dd>
</dl>
<p>The <code class="docutils literal notranslate"><span class="pre">fish</span></code> exit status is generally the <a class="reference internal" href="../language.html#variables-status"><span class="std std-ref">exit status of the last foreground command</span></a>.</p>
</section>
<section id="debugging">
<span id="debugging-fish"></span><h2>Debugging<a class="headerlink" href="#debugging" title="Link to this heading">¶</a></h2>
<p>While fish provides extensive support for <a class="reference internal" href="../language.html#debugging"><span class="std std-ref">debugging fish scripts</span></a>, it is also possible to debug and instrument its internals.
Debugging can be enabled by passing the <strong>--debug</strong> option.
For example, the following command turns on debugging for background IO thread events, in addition to the default categories, i.e. <em>debug</em>, <em>error</em>, <em>warning</em>, and <em>warning-path</em>:</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt; </span><span class="nf">fish</span><span class="w"> </span><span class="no">--debug=iothread</span>
</pre></div>
</div>
<p>Available categories are listed by <code class="docutils literal notranslate"><span class="pre">fish</span> <span class="pre">--print-debug-categories</span></code>. The <strong>--debug</strong> option accepts a comma-separated list of categories, and supports glob syntax.
The following command turns on debugging for <em>complete</em>, <em>history</em>, <em>history-file</em>, and <em>profile-history</em>, as well as the default categories:</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt; </span><span class="nf">fish</span><span class="w"> </span><span class="no">--debug=</span><span class="s1">&#39;complete,*history*&#39;</span>
</pre></div>
</div>
<p>Debug messages output to stderr by default. Note that if <span class="target" id="index-1"></span><a class="reference internal" href="../language.html#envvar-fish_trace"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">fish_trace</span></code></a> is set, execution tracing also outputs to stderr by default. You can output to a file using the <strong>--debug-output</strong> option:</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt; </span><span class="nf">fish</span><span class="w"> </span><span class="no">--debug=</span><span class="s1">&#39;complete,*history*&#39;</span><span class="w"> </span><span class="no">--debug-output=/tmp/fish.log</span><span class="w"> </span><span class="no">--init-command=</span><span class="s1">&#39;set fish_trace on&#39;</span>
</pre></div>
</div>
<p>These options can also be changed via the <span class="target" id="index-2"></span><a class="reference internal" href="../language.html#envvar-FISH_DEBUG"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">FISH_DEBUG</span></code></a> and <span class="target" id="index-3"></span><a class="reference internal" href="../language.html#envvar-FISH_DEBUG_OUTPUT"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">FISH_DEBUG_OUTPUT</span></code></a> variables.
The categories enabled via <strong>--debug</strong> are <em>added</em> to the ones enabled by $FISH_DEBUG, so they can be disabled by prefixing them with <strong>-</strong> (<strong>reader-*,-ast*</strong> enables reader debugging and disables ast debugging).</p>
<p>The file given in <strong>--debug-output</strong> takes precedence over the file in <span class="target" id="index-4"></span><a class="reference internal" href="../language.html#envvar-FISH_DEBUG_OUTPUT"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">FISH_DEBUG_OUTPUT</span></code></a>.</p>
</section>
<section id="examples">
<h2>Examples<a class="headerlink" href="#examples" title="Link to this heading">¶</a></h2>
<p>To just start fish:</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="nf">fish</span>
</pre></div>
</div>
<p>To run a file with fish:</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="nf">fish</span><span class="w"> </span><span class="no">/path/to/script.fish</span>
</pre></div>
</div>
<p>To run some commands with fish:</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="nf">fish</span><span class="w"> </span><span class="no">-c</span><span class="w"> </span><span class="s1">&#39;echo Hi there!&#39;</span>
</pre></div>
</div>
<p>You can also pass arguments to those commands:</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt; </span><span class="nf">fish</span><span class="w"> </span><span class="no">-c</span><span class="w"> </span><span class="s1">&#39;printf %s\n $argv&#39;</span><span class="w"> </span><span class="s2">&quot;first line&quot;</span><span class="w"> </span><span class="s2">&quot;second line&quot;</span>
<span class="go">first line</span>
<span class="go">second line</span>
</pre></div>
</div>
<p>To run a script, except read this other file first:</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="nf">fish</span><span class="w"> </span><span class="no">--init-cmd</span><span class="w"> </span><span class="s2">&quot;source otherfile&quot;</span><span class="w"> </span><span class="no">script.fish</span>
</pre></div>
</div>
<p>To <a class="reference internal" href="../language.html#profiling"><span class="std std-ref">profile</span></a> fish’s startup and find what takes the most time in your configuration:</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="nf">fish</span><span class="w"> </span><span class="no">--profile-startup</span><span class="w"> </span><span class="no">/tmp/start.prof</span><span class="w"> </span><span class="no">-ic</span><span class="w"> </span><span class="no">exit</span>
<span class="nf">sort</span><span class="w"> </span><span class="no">-nk2</span><span class="w"> </span><span class="no">/tmp/start.prof</span>
</pre></div>
</div>
</section>
</section>


            <div class="clearer"></div>
          </div>
        </div>
      </div> 
      <div class="clearer"></div>
    </div>  
    <div class="related" role="navigation" aria-label="Related">
      <h3>Navigation</h3>
      <ul>
    <li><img src="../_static/fish.png" alt=""
             style="width: 80px; height: 80px; vertical-align: middle; margin-top: -1px"/></li>
    <li><a href="https://fishshell.com/">fish-shell</a> &#187;</li>
    
    <a href="../index.html">fish-shell 4.2.1 documentation</a> &#187;
    

          <li class="nav-item nav-item-1"><a href="../commands.html" >Commands</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">fish - the friendly interactive shell</a></li>
    <li class="right">
        

    <div class="inline-search" role="search">
        <form class="inline-search" action="../search.html" method="get">
          <input placeholder="Quick search" type="text" name="q" />
          <input type="submit" value="Go" />
          <input type="hidden" name="check_keywords" value="yes" />
          <input type="hidden" name="area" value="default" />
        </form>
    </div>
    </li>
    
    <div id="old-docs-notice" style="display: none">
        This documents an old version of fish.
        <a href="../../current/">See the latest release.</a>
    </div>

      </ul>
    </div>  
    <div class="footer">
    &copy; Copyright fish-shell developers.
    <br />
    <a href="https://github.com/fish-shell/fish-shell/issues">Found a bug</a>?
    <br />

    Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.2.3.
    </div>
</div>

<script type="text/javascript">
 FISH_DOCS_VERSION = "4.2";

 function copy_to_clipboard(it) {
     // Find the pre tag we're interested in.
     var pre = it.target;
     while (pre.tagName != "PRE") pre = pre.parentNode;
     var txt = "";
     // Cheesy: If we have a prompt,
     // we only copy prompted lines,
     // by splitting and matching and stuff
     if (pre.querySelector('span.gp')) {
         var texts= [];
         for (var line of pre.innerText.split('\n')) {
             if (line.match(/^>_?.*/)) {
                 texts.push(line.replace(/^>_?/, ""));
             }
         }
         txt = texts.join("\n");
     } else {
         // Even cheesier: If we don't have a prompt, we remove the button text from the end.
         var txt = pre.innerText.substring(0, pre.innerText.length - it.target.innerText.length).trim();
     }

     navigator.clipboard.writeText(txt).then(function() {
         // Success - set the text to indicate it,
         // then set it back after 2 seconds.
         var span = pre.querySelector("button span");
         if (span) {
             var oldText = span.innerText;
             span.innerText = "COPIED!";
             setTimeout(function() {
                 span.innerText = oldText;
             }, 2000);
         }
     }, function() {
     });
 }

  (function () {
      // Add copy buttons to all the codeblocks.
      var codeblocks = document.querySelectorAll('div > pre');

      var button = document.createElement('button');
      var span = document.createElement('span');
      span.innerText = "COPY";
      button.appendChild(span);

      for (var i of codeblocks) {
          var newButton = button.cloneNode(true);
          newButton.addEventListener('click', copy_to_clipboard);
          i.appendChild(newButton);
      }
  })();
</script>

  </body>
</html>