summaryrefslogtreecommitdiff
path: root/devdocs/bash/directory-stack-builtins.html
diff options
context:
space:
mode:
Diffstat (limited to 'devdocs/bash/directory-stack-builtins.html')
-rw-r--r--devdocs/bash/directory-stack-builtins.html15
1 files changed, 15 insertions, 0 deletions
diff --git a/devdocs/bash/directory-stack-builtins.html b/devdocs/bash/directory-stack-builtins.html
new file mode 100644
index 00000000..f3b9aa48
--- /dev/null
+++ b/devdocs/bash/directory-stack-builtins.html
@@ -0,0 +1,15 @@
+<h1 class="subsection">Directory Stack Builtins</h1> <dl compact> <dt id="index-dirs"><span><code>dirs</code></span></dt> <dd>
+<div class="example"> <pre class="example">dirs [-clpv] [+N | -N]
+</pre>
+</div> <p>Display the list of currently remembered directories. Directories are added to the list with the <code>pushd</code> command; the <code>popd</code> command removes directories from the list. The current directory is always the first directory in the stack. </p> <dl compact> <dt><span><code>-c</code></span></dt> <dd><p>Clears the directory stack by deleting all of the elements. </p></dd> <dt><span><code>-l</code></span></dt> <dd><p>Produces a listing using full pathnames; the default listing format uses a tilde to denote the home directory. </p></dd> <dt><span><code>-p</code></span></dt> <dd><p>Causes <code>dirs</code> to print the directory stack with one entry per line. </p></dd> <dt><span><code>-v</code></span></dt> <dd><p>Causes <code>dirs</code> to print the directory stack with one entry per line, prefixing each entry with its index in the stack. </p></dd> <dt><span><code>+<var>N</var></code></span></dt> <dd><p>Displays the <var>N</var>th directory (counting from the left of the list printed by <code>dirs</code> when invoked without options), starting with zero. </p></dd> <dt><span><code>-<var>N</var></code></span></dt> <dd><p>Displays the <var>N</var>th directory (counting from the right of the list printed by <code>dirs</code> when invoked without options), starting with zero. </p></dd> </dl> </dd> <dt id="index-popd"><span><code>popd</code></span></dt> <dd>
+<div class="example"> <pre class="example">popd [-n] [+N | -N]
+</pre>
+</div> <p>Removes elements from the directory stack. The elements are numbered from 0 starting at the first directory listed by <code>dirs</code>; that is, <code>popd</code> is equivalent to <code>popd +0</code>. </p> <p>When no arguments are given, <code>popd</code> removes the top directory from the stack and changes to the new top directory. </p> <p>Arguments, if supplied, have the following meanings: </p> <dl compact> <dt><span><code>-n</code></span></dt> <dd><p>Suppresses the normal change of directory when removing directories from the stack, so that only the stack is manipulated. </p></dd> <dt><span><code>+<var>N</var></code></span></dt> <dd><p>Removes the <var>N</var>th directory (counting from the left of the list printed by <code>dirs</code>), starting with zero, from the stack. </p></dd> <dt><span><code>-<var>N</var></code></span></dt> <dd><p>Removes the <var>N</var>th directory (counting from the right of the list printed by <code>dirs</code>), starting with zero, from the stack. </p></dd> </dl> <p>If the top element of the directory stack is modified, and the <samp>-n</samp> option was not supplied, <code>popd</code> uses the <code>cd</code> builtin to change to the directory at the top of the stack. If the <code>cd</code> fails, <code>popd</code> returns a non-zero value. </p> <p>Otherwise, <code>popd</code> returns an unsuccessful status if an invalid option is encountered, the directory stack is empty, or a non-existent directory stack entry is specified. </p> <p>If the <code>popd</code> command is successful, Bash runs <code>dirs</code> to show the final contents of the directory stack, and the return status is 0. </p> </dd> <dt><span><code>pushd</code></span></dt> <dd>
+<div class="example"> <pre class="example">pushd [-n] [+N | -N | dir]
+</pre>
+</div> <p>Adds a directory to the top of the directory stack, or rotates the stack, making the new top of the stack the current working directory. With no arguments, <code>pushd</code> exchanges the top two elements of the directory stack. </p> <p>Arguments, if supplied, have the following meanings: </p> <dl compact> <dt><span><code>-n</code></span></dt> <dd><p>Suppresses the normal change of directory when rotating or adding directories to the stack, so that only the stack is manipulated. </p></dd> <dt><span><code>+<var>N</var></code></span></dt> <dd><p>Brings the <var>N</var>th directory (counting from the left of the list printed by <code>dirs</code>, starting with zero) to the top of the list by rotating the stack. </p></dd> <dt><span><code>-<var>N</var></code></span></dt> <dd><p>Brings the <var>N</var>th directory (counting from the right of the list printed by <code>dirs</code>, starting with zero) to the top of the list by rotating the stack. </p></dd> <dt><span><code><var>dir</var></code></span></dt> <dd><p>Makes <var>dir</var> be the top of the stack. </p></dd> </dl> <p>After the stack has been modified, if the <samp>-n</samp> option was not supplied, <code>pushd</code> uses the <code>cd</code> builtin to change to the directory at the top of the stack. If the <code>cd</code> fails, <code>pushd</code> returns a non-zero value. </p> <p>Otherwise, if no arguments are supplied, <code>pushd</code> returns 0 unless the directory stack is empty. When rotating the directory stack, <code>pushd</code> returns 0 unless the directory stack is empty or a non-existent directory stack element is specified. </p> <p>If the <code>pushd</code> command is successful, Bash runs <code>dirs</code> to show the final contents of the directory stack. </p> </dd> </dl><div class="_attribution">
+ <p class="_attribution-p">
+ Copyright &copy; 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.<br>Licensed under the GNU Free Documentation License.<br>
+ <a href="https://www.gnu.org/software/bash/manual/html_node/Directory-Stack-Builtins.html" class="_attribution-link">https://www.gnu.org/software/bash/manual/html_node/Directory-Stack-Builtins.html</a>
+ </p>
+</div>