From 020335dfbf84fadd414cf8310853605baf1df1d1 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Wed, 9 Dec 2009 10:10:18 +0000 Subject: [PATCH] * eshell.texi (History): Add the other built-in variables. (Built-ins): Explain built-ins, and how to apply the external commands. Add `history', `su' and `sudo'. * tramp.texi (Remote processes): Add missing in the example. --- doc/misc/ChangeLog | 8 +++++ doc/misc/eshell.texi | 70 +++++++++++++++++++++++++++++++++++++++++++- doc/misc/tramp.texi | 5 ++-- 3 files changed, 80 insertions(+), 3 deletions(-) diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index eb8877e9f51..05ee0cfb357 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,11 @@ +2009-12-09 Michael Albinus + + * eshell.texi (History): Add the other built-in variables. + (Built-ins): Explain built-ins, and how to apply the external commands. + Add `history', `su' and `sudo'. + + * tramp.texi (Remote processes): Add missing in the example. + 2009-12-01 Bill Wohler * mh-e.texi (Searching): Use mh vfolder_format and fix typo in database diff --git a/doc/misc/eshell.texi b/doc/misc/eshell.texi index e7d4132c4b8..f0b2374b59a 100644 --- a/doc/misc/eshell.texi +++ b/doc/misc/eshell.texi @@ -334,6 +334,20 @@ This variable always contains the current working directory. This variable always contains the previous working directory (the current working directory from before the last @code{cd} command). +@item $_ +@vindex $_ +It refers to the last argument of the last command. + +@item $$ +@vindex $$ +This is the result of the last command. In case of an external +command, it is @code{t} or @code{nil}. + +@item $? +@vindex $? +This variable contains the exit code of the last command (0 or 1 for +Lisp functions, based on successful completion). + @end table @node Scripts @@ -343,7 +357,19 @@ current working directory from before the last @code{cd} command). @node Built-ins @section Built-in commands -Here is a list of built-in commands that Eshell knows about: +Several commands are built-in in Eshell. In order to call the +external variant of a built-in command @code{foo}, you could call +@code{*foo}. Usually, this should not be necessary. You can check +what will be applied by the @code{which} command: + +@example +~ $ which ls +eshell/ls is a compiled Lisp function in `em-ls.el' +~ $ which *ls +/bin/ls +@end example + +Some of the built-in commands have a special behaviour in Eshell: @table @code @@ -367,6 +393,48 @@ that directory. With @samp{cd -42}, you can access the directory stack by number. +@item history +@findex history +The @samp{history} command shows all commands kept in the history ring +as numbered list. If the history ring contains +@code{eshell-history-size} commands, those numbers change after every +command invocation, therefore the @samp{history} command shall be +applied before using the expansion mechanism with history numbers. + +The n-th entry of the history ring can be applied with the @samp{!n} +command. If @code{n} is negative, the entry is counted from the end +of the history ring. + +@samp{!foo} expands to the last command beginning with @code{foo}, and +@samp{!?foo} to the last command containing @code{foo}. The n-th +argument of the last command beginning with @code{foo} is accessible +by @code{!foo:n}. + +@item su +@findex su +@itemx sudo +@findex sudo +@code{su} and @code{sudo} work as expected: they apply the following +commands (@code{su}), or the command being an argument (@code{sudo}) +under the permissions of somebody else. + +This does not work only on +the local host, but even on a remote one, when +@code{default-directory} is a remote file name. The necessary +proxy configuration of Tramp is performed +@ifinfo +automatically, @ref{Multi-hops, , , tramp}. +@end ifinfo +@ifnotinfo +automatically. +@end ifnotinfo +Example: + +@example +~ $ cd /ssh:otherhost:/etc +/ssh:user@@otherhost:/etc $ sudo find-file shadow +@end example + @end table diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index f0c0b6a3924..d68be209a99 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -2594,10 +2594,11 @@ variable @code{tramp-default-proxies-alist} (@pxref{Multi-hops}): @example @b{~ $} cd @trampfn{ssh, user, remotehost, /etc} @key{RET} -@b{@trampfn{ssh, user, remotehost, /etc} $} find-file shadow +@b{@trampfn{ssh, user, remotehost, /etc} $} find-file shadow @key{RET} File is not readable: @trampfn{ssh, user, remotehost, /etc/shadow} -@b{@trampfn{ssh, user, remotehost, /etc} $} sudo find-file shadow +@b{@trampfn{ssh, user, remotehost, /etc} $} sudo find-file shadow @key{RET} # + @b{@trampfn{ssh, user, remotehost, /etc} $} su - @key{RET} @b{@trampfn{su, root, remotehost, /root} $} id @key{RET} uid=0(root) gid=0(root) groups=0(root)