This file is pushd.def, from which is created pushd.c. It implements the
builtins "pushd", "popd", and "dirs" in Bash.
-Copyright (C) 1987-2006 Free Software Foundation, Inc.
+Copyright (C) 1987-2008 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
the stack, making the new top of the stack the current working
directory. With no arguments, exchanges the top two directories.
--n Suppresses the normal change of directory when adding directories
- to the stack, so only the stack is manipulated.
+Options:
-+N Rotates the stack so that the Nth directory (counting
+ -n Suppresses the normal change of directory when adding
+ directorie to the stack, so only the stack is manipulated.
+
+Arguments:
+
+ +N Rotates the stack so that the Nth directory (counting
from the left of the list shown by `dirs', starting with
zero) is at the top.
--N Rotates the stack so that the Nth directory (counting
+ -N Rotates the stack so that the Nth directory (counting
from the right of the list shown by `dirs', starting with
zero) is at the top.
-dir Adds DIR to the directory stack at the top, making it the
+ dir Adds DIR to the directory stack at the top, making it the
new current working directory.
-You can see the directory stack with the `dirs' command.
+The `dirs' builtin displays the directory stack.
$END
$BUILTIN popd
$FUNCTION popd_builtin
$DEPENDS_ON PUSHD_AND_POPD
$SHORT_DOC popd [-n] [+N | -N]
-Removes entries from the directory stack. With no arguments,
-removes the top directory from the stack, and cd's to the new
-top directory.
+Removes entries from the directory stack. With no arguments, removes
+the top directory from the stack, and changes to the new top directory.
+
+Options:
--n Suppresses the normal change of directory when removing directories
- from the stack, so only the stack is manipulated.
+ -n Suppresses the normal change of directory when removing
+ directories from the stack, so only the stack is manipulated.
-+N Removes the Nth entry counting from the left of the list
+Arguments:
+
+ +N Removes the Nth entry counting from the left of the list
shown by `dirs', starting with zero. For example: `popd +0'
removes the first directory, `popd +1' the second.
--N Removes the Nth entry counting from the right of the list
+ -N Removes the Nth entry counting from the right of the list
shown by `dirs', starting with zero. For example: `popd -0'
removes the last directory, `popd -1' the next to last.
-You can see the directory stack with the `dirs' command.
+The `dirs' builtin displays the directory stack.
$END
$BUILTIN dirs
find their way onto the list with the `pushd' command; you can get
back up through the list with the `popd' command.
-The -c flag clears the directory stack by deleting all of the elements.
-The -l flag specifies that `dirs' should not print shorthand versions
-of directories which are relative to your home directory. This means
-that `~/bin' might be displayed as `/homes/bfox/bin'. The -p flag
-causes `dirs' to print the directory stack with one entry per line.
-The -v flag does the same thing, prefixing each directory name with its
-position in the stack.
+Options:
+
+ -c clear the directory stack by deleting all of the elements
+ -l do not print tilde-prefixed versions of directories relative
+ to your home directory
+ -p print the directory stack with one entry per line
+ -v print the directory stack with one entry per line prefixed
+ with its position in the stack
-+N Displays the Nth entry counting from the left of the list shown by
+Arguments:
+
+ +N Displays the Nth entry counting from the left of the list shown by
dirs when invoked without options, starting with zero.
--N Displays the Nth entry counting from the right of the list shown by
+ -N Displays the Nth entry counting from the right of the list shown by
dirs when invoked without options, starting with zero.
$END
if (index_flag)
{
putchar ('\n');
- return EXECUTION_SUCCESS;
+ return (sh_chkwrite (EXECUTION_SUCCESS));
}
}
printf ("%s%s", (vflag & 1) ? "\n" : " ", DIRSTACK_ENTRY (i));
putchar ('\n');
- fflush (stdout);
- return (EXECUTION_SUCCESS);
+
+ return (sh_chkwrite (EXECUTION_SUCCESS));
}
static void
find their way onto the list with the `pushd' command; you can get\n\
back up through the list with the `popd' command.\n\
\n\
+ The -c flag clears the directory stack by deleting all of the elements.\n\
The -l flag specifies that `dirs' should not print shorthand versions\n\
of directories which are relative to your home directory. This means\n\
- that `~/bin' might be displayed as `/homes/bfox/bin'. The -v flag\n\
- causes `dirs' to print the directory stack with one entry per line,\n\
- prepending the directory name with its position in the stack. The -p\n\
- flag does the same thing, but the stack position is not prepended.\n\
- The -c flag clears the directory stack by deleting all of the elements.\n\
+ that `~/bin' might be displayed as `/homes/bfox/bin'. The -p flag\n\
+ causes `dirs' to print the directory stack with one entry per line.\n\
+ The -v flag does the same thing, prefixing each directory name with its\n\
+ position in the stack.\n\
\n\
- +N displays the Nth entry counting from the left of the list shown by\n\
+ +N Displays the Nth entry counting from the left of the list shown by\n\
dirs when invoked without options, starting with zero.\n\
\n\
- -N displays the Nth entry counting from the right of the list shown by\n\
+ -N Displays the Nth entry counting from the right of the list shown by\n\
dirs when invoked without options, starting with zero."),
(char *)NULL
};
the stack, making the new top of the stack the current working\n\
directory. With no arguments, exchanges the top two directories.\n\
\n\
+ -n Suppresses the normal change of directory when adding directories\n\
+ to the stack, so only the stack is manipulated.\n\
+ \n\
+N Rotates the stack so that the Nth directory (counting\n\
from the left of the list shown by `dirs', starting with\n\
zero) is at the top.\n\
from the right of the list shown by `dirs', starting with\n\
zero) is at the top.\n\
\n\
- -n suppress the normal change of directory when adding directories\n\
- to the stack, so only the stack is manipulated.\n\
- \n\
- dir adds DIR to the directory stack at the top, making it the\n\
+ dir Adds DIR to the directory stack at the top, making it the\n\
new current working directory.\n\
\n\
You can see the directory stack with the `dirs' command."),
removes the top directory from the stack, and cd's to the new\n\
top directory.\n\
\n\
- +N removes the Nth entry counting from the left of the list\n\
+ -n Suppresses the normal change of directory when removing directories\n\
+ from the stack, so only the stack is manipulated.\n\
+ \n\
+ +N Removes the Nth entry counting from the left of the list\n\
shown by `dirs', starting with zero. For example: `popd +0'\n\
removes the first directory, `popd +1' the second.\n\
\n\
- -N removes the Nth entry counting from the right of the list\n\
+ -N Removes the Nth entry counting from the right of the list\n\
shown by `dirs', starting with zero. For example: `popd -0'\n\
removes the last directory, `popd -1' the next to last.\n\
\n\
- -n suppress the normal change of directory when removing directories\n\
- from the stack, so only the stack is manipulated.\n\
- \n\
You can see the directory stack with the `dirs' command."),
(char *)NULL
};