Mercurial > emacs
comparison man/dired.texi @ 46203:09a72d736076
Update description of * and ? for shell commands.
Mention that v uses external viewers.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 07 Jul 2002 11:15:33 +0000 |
parents | 729648fff079 |
children | 695cf19ef79e d7ddb3e565de |
comparison
equal
deleted
inserted
replaced
46202:abfe123bd6ff | 46203:09a72d736076 |
---|---|
274 to display the file, like the @kbd{o} command. | 274 to display the file, like the @kbd{o} command. |
275 | 275 |
276 @item v | 276 @item v |
277 @kindex v @r{(Dired)} | 277 @kindex v @r{(Dired)} |
278 @findex dired-view-file | 278 @findex dired-view-file |
279 View the file described on the current line, using @kbd{M-x view-file} | 279 View the file described on the current line, using either an external |
280 (@code{dired-view-file}). | 280 viewing program or @kbd{M-x view-file} (@code{dired-view-file}). |
281 | 281 |
282 Viewing a file is like visiting it, but is slanted toward moving around | 282 @vindex dired-view-command-alist |
283 in the file conveniently and does not allow changing the file. | 283 External viewers are used for certain file types under the control of |
284 @xref{Misc File Ops,View File, Miscellaneous File Operations}. | 284 @code{dired-view-command-alist}. Viewing a file with @code{view-file} |
285 is like visiting it, but is slanted toward moving around in the file | |
286 conveniently and does not allow changing the file. @xref{Misc File | |
287 Ops,View File, Miscellaneous File Operations}. | |
285 | 288 |
286 @item ^ | 289 @item ^ |
287 @kindex ^ @r{(Dired)} | 290 @kindex ^ @r{(Dired)} |
288 @findex dired-up-directory | 291 @findex dired-up-directory |
289 Visit the parent directory of the current directory | 292 Visit the parent directory of the current directory |
656 (@pxref{Operating on Files}). There are two ways of applying a shell | 659 (@pxref{Operating on Files}). There are two ways of applying a shell |
657 command to multiple files: | 660 command to multiple files: |
658 | 661 |
659 @itemize @bullet | 662 @itemize @bullet |
660 @item | 663 @item |
661 If you use @samp{*} in the shell command, then it runs just once, with | 664 If you use @samp{*} surrounded by whitespace in the shell command, |
662 the list of file names substituted for the @samp{*}. The order of file | 665 then the command runs just once, with the list of file names |
663 names is the order of appearance in the Dired buffer. | 666 substituted for the @samp{*}. The order of file names is the order of |
667 appearance in the Dired buffer. | |
664 | 668 |
665 Thus, @kbd{! tar cf foo.tar * @key{RET}} runs @code{tar} on the entire | 669 Thus, @kbd{! tar cf foo.tar * @key{RET}} runs @code{tar} on the entire |
666 list of file names, putting them into one tar file @file{foo.tar}. | 670 list of file names, putting them into one tar file @file{foo.tar}. |
667 | 671 |
672 If you want to use @samp{*} as a shell wildcard with whitespace around | |
673 it, write @samp{*""}. In the shell, this is equivalent to @samp{*}; | |
674 but since the @samp{*} is not surrounded by whitespace, Dired does | |
675 not treat it specially. | |
676 | |
668 @item | 677 @item |
669 If the command string doesn't contain @samp{*}, then it runs once | 678 If the command string doesn't contain @samp{*} surrounded by |
670 @emph{for each file}, with the file name added at the end. | 679 whitespace, then it runs once @emph{for each file}. Normally the file |
680 name is added at the end. | |
671 | 681 |
672 For example, @kbd{! uudecode @key{RET}} runs @code{uudecode} on each | 682 For example, @kbd{! uudecode @key{RET}} runs @code{uudecode} on each |
673 file. | 683 file. |
674 @end itemize | 684 |
675 | 685 @item |
676 What if you want to run the shell command once for each file, with the | 686 If the command string contains @samp{?} surrounded by whitespace, the |
677 file name inserted in the middle? You can use @samp{?} in the command | 687 current file name is substituted for @samp{?}. You can use @samp{?} |
678 instead of @samp{*}. The current file name is substituted for | 688 this way more than once in the command, and each occurrence is |
679 @samp{?}. You can use @samp{?} more than once. For instance, here is | 689 replaced. For instance, here is how to uuencode each file, making the |
680 how to uuencode each file, making the output file name by appending | 690 output file name by appending @samp{.uu} to the input file name: |
681 @samp{.uu} to the input file name: | |
682 | 691 |
683 @example | 692 @example |
684 uuencode ? ? > ?.uu | 693 uuencode ? ? > ?.uu |
685 @end example | 694 @end example |
686 | 695 @end itemize |
687 To use the file names in a more complicated fashion, you can use a | 696 |
688 shell loop. For example, this shell command is another way to | 697 To iterate over the file names in a more complicated fashion, use an |
689 uuencode each file: | 698 explicit shell loop. For example, this shell command is another way |
699 to uuencode each file: | |
690 | 700 |
691 @example | 701 @example |
692 for file in *; do uuencode "$file" "$file" >"$file".uu; done | 702 for file in * ; do uuencode "$file" "$file" >"$file".uu; done |
693 @end example | 703 @end example |
704 | |
705 @noindent | |
706 This simple example doesn't require a shell loop (you can do it | |
707 with @samp{?}, but it illustrates the technique. | |
694 | 708 |
695 The working directory for the shell command is the top-level directory | 709 The working directory for the shell command is the top-level directory |
696 of the Dired buffer. | 710 of the Dired buffer. |
697 | 711 |
698 The @kbd{!} command does not attempt to update the Dired buffer to show | 712 The @kbd{!} command does not attempt to update the Dired buffer to show |