Back to Fish

fish user documentation

site/docs/2.1/doc_8h_source.html

latest9.8 KB
Original Source

fish shell | Documentation | Tutorial | Design | Commands | FAQ | License

doc.h

1

1497 \htmlonly </div> \endhtmlonly

1552 color: #005fd7;

1553 font-weight: normal;

1554 }

1555

1556 pre i {

1557/* Used for arguments */

1558 color: #00afff;

1559 font-style: normal;

1560 }

1561

1562 pre em {

1563/* Used for path/help word */

1564 color: #0a0;

1565 font-style: normal;

1566 }

1567

1568 .quote {

1569 color: #A50;

1570 }

1571

1572 .error {

1573/* Used for errors */

1574 color: #F55;

1575 font-weight: bold;

1576 }

1577

1578 .tutorial_nav {

1579 position: relative;

1580 z-index: 2;

1581 margin-left: 10px;

1582 margin-top: 15px;

1583 }

1584

1585 .tutorial_nav ul {

1586 padding: 0 15px;

1587 margin: 0;

1588 }

1589

1590 .tutorial_nav li {

1591 margin: 0;

1592 line-height: normal;

1593 height: auto;

1594 color: #EEE;

1595 font-size: 12pt;

1596 font-family: "Trebuchet MS", Verdana, Arial, sans-serif;

1597 list-style-image: none;

1598 list-style-position: outside;

1599 list-style-type: none;

1600 padding: 3px 15px;

1601 margin: 0 -15px;

1602 }

1603

1604 .tutorial_nav a {

1605 color: inherit;

1606 text-decoration: none;

1607 font-family:

1608 font-size: 12pt;

1609 }

1610

1611 .tutorial_nav .chevron {

1612 font-family: Times, "Times New Roman";

1613 color: #DDF;

1614 font-size: 16pt;

1615 line-height: 10pt;

1616 font-weight: bold;

1617 }

1618

1619 .no_shadow > li > a,

1620 .no_shadow {

1621 text-shadow: none;

1622 }

1623

1624 .nav > li > a:hover {

1625 text-decoration: none;

1626 background-color: inherit;

1627 color: #99BBFF;

1628 }

1629

1630 /* Override some default left bar stuff */

1631 ul.nav li {

1632 margin-bottom: 0;

1633 }

1634

1635

1636 .title_top {

1637 width: 100%;

1638 text-align: left;

1639 color: white;

1640 font-size: 18pt;

1641 height: 72px;

1642 z-index: 1;

1643 text-indent: 260px;

1644 }

1645

1646 .tutorial_content {

1647 -moz-box-shadow: -5px 0px 5px -2px black;

1648 -webkit-box-shadow: -5px 0px 5px -2px black;

1649 box-shadow: -5px 0px 5px -2px black;

1650

1651 margin-left: 280px;

1652 padding: 1px 25px 10px 10px;

1653 position: relative;

1654 z-index: 5;

1655 background-color: white;

1656 }

1657

1658 h3 {

1659 font-size: 25px;

1660 margin-top: 12px;

1661 }

1662

1663 h1, h2, h3 { color: #1E335E; }

1664 h1.interior_title {

1665 color: #333;

1666 padding-bottom: 10px;

1667 border-bottom: 1px solid #AAA;

1668 }

1669

1670 h1 { font-size: 150%; }

1671 h2 { font-size: 135%; }

1672 h3 { font-size: 110%; }

1673

1674

1675

1676 </style>

1677

1678

1679 <div class="fish_left_bar fish_left_medium">

1680 <div class="tutorial_nav">

1681 <ul class="nav no_shadow">

1682 <li><a href="#tut_why_fish"><span class="chevron">›</span> Why fish?</a></li>

1683 <li><a href="#tut_learning_Fish"><span class="chevron">›</span> Learning fish</a></li>

1684 <li><a href="#tut_running_commands"><span class="chevron">›</span> Running Commands</a></li>

1685 <li><a href="#tut_getting_help"><span class="chevron">›</span> Getting Help</a></li>

1686 <li><a href="#tut_syntax_highlighting"><span class="chevron">›</span> Syntax Highlighting</a></li>

1687 <li><a href="#tut_wildcards"><span class="chevron">›</span> Wildcards</a></li>

1688 <li><a href="#tut_pipes_and_redirections"><span class="chevron">›</span> Pipes and Redirections</a></li>

1689 <li><a href="#tut_autosuggestions"><span class="chevron">›</span> Autosuggestions</a></li>

1690 <li><a href="#tut_tab_completions"><span class="chevron">›</span> Tab Completions</a></li>

1691 <li><a href="#tut_variables"><span class="chevron">›</span> Variables</a></li>

1692 <li><a href="#tut_exit_status"><span class="chevron">›</span> Exit Status</a></li>

1693 <li><a href="#tut_exports"><span class="chevron">›</span> Environment Variables</a></li>

1694 <li><a href="#tut_lists"><span class="chevron">›</span> Lists</a></li>

1695 <li><a href="#tut_command_substitutions"><span class="chevron">›</span> Command Substitutions</a></li>

1696 <li><a href="#tut_combiners"><span class="chevron">›</span> Combiners (And, Or, Not)</a></li>

1697 <li><a href="#tut_conditionals"><span class="chevron">›</span> Conditionals (If, Else, Switch)</a></li>

1698 <li><a href="#tut_functions"><span class="chevron">›</span> Functions</a></li>

1699 <li><a href="#tut_loops"><span class="chevron">›</span> Loops</a></li>

1700 <li><a href="#tut_prompt"><span class="chevron">›</span> Prompt</a></li>

1701 <li><a href="#tut_startup"><span class="chevron">›</span> Startup</a></li>

1702 </ul>

1703 </div>

1704 </div>

1705

1706 <div class="fish_right_bar fish_right_medium">

1707

1708 <h1 class="interior_title">fish tutorial</h1>

1709

1710 <h2 id="tut_why_fish">Why fish?</h2>

1711

1712 <p>fish is a fully-equipped command line shell (like bash or zsh) that is smart and user-friendly. fish supports powerful features like syntax highlighting, autosuggestions, and tab completions that just work, with nothing to learn or configure.

1713

1714 <p>If you want to make your command line more productive, more useful, and more fun, without learning a bunch of arcane syntax and configuration options, then fish might be just what you're looking for!

1715

1716 <h2 id="tut_learning_Fish">Learning fish</h2>

1717

1718 <p>This tutorial assumes a basic understanding of command line shells and Unix commands, and that you have a working copy of fish.

1719

1720 <p>If you have a strong understanding of other shells, and want to know what fish does differently, search for the magic phrase <i>unlike other shells</i>, which is used to call out important differences.

1721

1722 <p>When you start fish, you should see this:

1723

1724 <pre>

1725 Welcome to fish, the friendly interactive shell

1726 Type <em>help</em> for instructions on how to use fish

1727 you@hostname <em>~</em>>

1728 </pre>

1729

1730 <p>fish comes with a default prompt that shows your username, hostname, and working directory. You'll see <a href="#tut_prompt">how to change your prompt</a> further down. From now on, we'll pretend your prompt is just a '>' to save space.

1731

1732 <h2 id="tut_running_commands">Running Commands</h2>

1733

1734 <p>fish runs commands like other shells: you type a command, followed by its arguments. Spaces are separators:

1735

1736 <pre>

1737 > <b>echo</b> <i>hello world</i>

1738 hello world

1739 </pre>

1740

1741 You can include a literal space in an argument with a backslash, or by using single or double quotes:

1742

1743 <pre>

1744 > <b>mkdir</b> <i>My\ Files</i>

1745 > <b>cp</b> <i>~/Some\ File</i> <i class=quote>'My Files'</i>

1746 > <b>ls</b> <i class=quote>"My Files"</i>

1747 Some File

1748 </pre>

1749

1750 Commands can be chained with semicolons.

1751

1752 <h2 id="tut_getting_help">Getting Help</h2>

1753

1754 fish has excellent help and man pages. Run <tt>help</tt> to open help in a web browser, and <tt>man</tt> to open it in a man page. You can also ask for help with a specific command, for example, <tt>help set</tt> to open in a web browser, or <tt>man set</tt> to see it in the terminal.

1755

1756 <pre>

1757 > <b>man</b> <i>set</i>

1758 set - handle environment variables

1759 Synopsis...

1760 </pre>

1761

1762 <h2 id="tut_syntax_highlighting">Syntax Highlighting</h2>

1763 You'll quickly notice that fish performs syntax highlighting as you type. Invalid commands are colored red by default:

1764

1765 <pre>

1766 > <b class="error">/bin/mkd</b>

1767 </pre>

1768

1769 A command may be invalid because it does not exist, or refers to a file that you cannot execute. When the command becomes valid, it is shown in a different color:

1770

1771 <pre>

1772 > <b>/bin/mkdir</b>

1773 </pre>

1774

1775 fish will underline valid file paths as you type them:

1776

1777 <pre>

1778 > <b>cat</b> <i><span style="text-decoration: underline">~/somef<u>i</u></span></i>

1779 </pre>

1780

1781 <p>This tells you that there exists a file that starts with '<tt>somefi</tt>', which is useful feedback as you type.

1782

1783 <p>These colors, and many more, can be changed by running <tt>fish_config</tt>, or by modifying variables directly.

1784

1785 <h2 id="tut_wildcards">Wildcards</h2>

1786

1787 fish supports the familiar wildcard *. To list all JPEG files:

1788

1789 <pre>

1790 > <b>ls</b> <i>*.jpg</i>

1791 lena.jpg

1792 meena.jpg

1793 santa maria.jpg

1794 </pre>

1795

1796 <p>You can include multiple wildcards:

1797

1798 <pre>

1799 > <b>ls</b> <i>l*.p*</i>

1800 lena.png

1801 lesson.pdf

1802 </pre>

1803

1804 <p>Especially powerful is the <i>recursive wildcard</i> ** which searches directories recursively:

1805

1806 <pre>

1807 > <b>ls</b> <i>/var

2381

3786

6603


Generated on Fri Nov 1 2013 17:28:48 for fish by 1.8.4