276 |
@item v |
@item v |
277 |
@kindex v @r{(Dired)} |
@kindex v @r{(Dired)} |
278 |
@findex dired-view-file |
@findex dired-view-file |
279 |
View the file described on the current line, using @kbd{M-x view-file} |
View the file described on the current line, using either an external |
280 |
(@code{dired-view-file}). |
viewing program or @kbd{M-x view-file} (@code{dired-view-file}). |
281 |
|
|
282 |
Viewing a file is like visiting it, but is slanted toward moving around |
@vindex dired-view-command-alist |
283 |
in the file conveniently and does not allow changing the file. |
External viewers are used for certain file types under the control of |
284 |
@xref{Misc File Ops,View File, Miscellaneous File Operations}. |
@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}. |
288 |
|
|
289 |
@item ^ |
@item ^ |
290 |
@kindex ^ @r{(Dired)} |
@kindex ^ @r{(Dired)} |
661 |
|
|
662 |
@itemize @bullet |
@itemize @bullet |
663 |
@item |
@item |
664 |
If you use @samp{*} in the shell command, then it runs just once, with |
If you use @samp{*} surrounded by whitespace in the shell command, |
665 |
the list of file names substituted for the @samp{*}. The order of file |
then the command runs just once, with the list of file names |
666 |
names is the order of appearance in the Dired buffer. |
substituted for the @samp{*}. The order of file names is the order of |
667 |
|
appearance in the Dired buffer. |
668 |
|
|
669 |
Thus, @kbd{! tar cf foo.tar * @key{RET}} runs @code{tar} on the entire |
Thus, @kbd{! tar cf foo.tar * @key{RET}} runs @code{tar} on the entire |
670 |
list of file names, putting them into one tar file @file{foo.tar}. |
list of file names, putting them into one tar file @file{foo.tar}. |
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 |
|
|
677 |
@item |
@item |
678 |
If the command string doesn't contain @samp{*}, then it runs once |
If the command string doesn't contain @samp{*} surrounded by |
679 |
@emph{for each file}, with the file name added at the end. |
whitespace, then it runs once @emph{for each file}. Normally the file |
680 |
|
name is added at the end. |
681 |
|
|
682 |
For example, @kbd{! uudecode @key{RET}} runs @code{uudecode} on each |
For example, @kbd{! uudecode @key{RET}} runs @code{uudecode} on each |
683 |
file. |
file. |
|
@end itemize |
|
684 |
|
|
685 |
What if you want to run the shell command once for each file, with the |
@item |
686 |
file name inserted in the middle? You can use @samp{?} in the command |
If the command string contains @samp{?} surrounded by whitespace, the |
687 |
instead of @samp{*}. The current file name is substituted for |
current file name is substituted for @samp{?}. You can use @samp{?} |
688 |
@samp{?}. You can use @samp{?} more than once. For instance, here is |
this way more than once in the command, and each occurrence is |
689 |
how to uuencode each file, making the output file name by appending |
replaced. For instance, here is how to uuencode each file, making the |
690 |
@samp{.uu} to the input file name: |
output file name by appending @samp{.uu} to the input file name: |
691 |
|
|
692 |
@example |
@example |
693 |
uuencode ? ? > ?.uu |
uuencode ? ? > ?.uu |
694 |
@end example |
@end example |
695 |
|
@end itemize |
696 |
|
|
697 |
To use the file names in a more complicated fashion, you can use a |
To iterate over the file names in a more complicated fashion, use an |
698 |
shell loop. For example, this shell command is another way to |
explicit shell loop. For example, this shell command is another way |
699 |
uuencode each file: |
to uuencode each file: |
700 |
|
|
701 |
@example |
@example |
702 |
for file in *; do uuencode "$file" "$file" >"$file".uu; done |
for file in * ; do uuencode "$file" "$file" >"$file".uu; done |
703 |
@end example |
@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. |
708 |
|
|
709 |
The working directory for the shell command is the top-level directory |
The working directory for the shell command is the top-level directory |
710 |
of the Dired buffer. |
of the Dired buffer. |
711 |
|
|