summaryrefslogtreecommitdiff
path: root/Doc/Zsh/expn.yo
diff options
context:
space:
mode:
authorFrank Terbeck <ft@bewatermyfriend.org>2011-12-01 10:02:04 +0100
committerFrank Terbeck <ft@bewatermyfriend.org>2011-12-01 10:02:04 +0100
commitd8da5ea2f2bc5f837d0b364fff2636ebdb2f90ca (patch)
tree9fd9a57486ac4702608d92088ffd91f52971244f /Doc/Zsh/expn.yo
parentaf2bb4fdb09414d21922d3fafe4e3a0ac1332f01 (diff)
parent9d71f4c207fb34e8d64af0443c83231b1cc3b494 (diff)
downloadzsh-d8da5ea2f2bc5f837d0b364fff2636ebdb2f90ca.tar.gz
zsh-d8da5ea2f2bc5f837d0b364fff2636ebdb2f90ca.zip
Merge commit 'zsh-4.3.13' into debian
Diffstat (limited to 'Doc/Zsh/expn.yo')
-rw-r--r--Doc/Zsh/expn.yo48
1 files changed, 34 insertions, 14 deletions
diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index ce122cade..28d525f14 100644
--- a/Doc/Zsh/expn.yo
+++ b/Doc/Zsh/expn.yo
@@ -236,7 +236,10 @@ a glob qualifier unless a file of the same name is found in the
current directory.
)
item(tt(e))(
-Remove all but the extension.
+Remove all but the part of the filename extension following the `tt(.)';
+see the definition of the filename extension in the description of the
+tt(r) modifier below. Note that according to that definition the result
+will be empty if the string ends with a `tt(.)'.
)
item(tt(h))(
Remove a trailing pathname component, leaving the head. This works
@@ -259,8 +262,12 @@ item(tt(Q))(
Remove one level of quotes from the substituted words.
)
item(tt(r))(
-Remove a filename extension of the form `tt(.)var(xxx)', leaving
-the root name.
+Remove a filename extension leaving the root name. Strings with no
+filename extension are not altered. A filename
+extension is a `tt(.)' followed by any number of characters (including
+zero) that are neither `tt(.)' nor `tt(/)' and that continue to the end
+of the string. For example, the extension of
+`tt(foo.orig.c)' is `tt(.c)', and `tt(dir.c/foo)' has no extension.
)
item(tt(s/)var(l)tt(/)var(r)[tt(/)])(
Substitute var(r) for var(l) as described below.
@@ -464,6 +471,18 @@ example(tt({ paste <LPAR()cut -f1) var(file1)tt(RPAR() <LPAR()cut -f3) var(file2
The extra processes here are
spawned from the parent shell which will wait for their completion.
+Another problem arises any time a job with a substitution that requires
+a temporary file is disowned by the shell, including the case where
+`tt(&!)' or `tt(&|)' appears at the end of a command containing a
+subsitution. In that case the temporary file will not be cleaned up as
+the shell no longer has any memory of the job. A workaround is to use
+a subshell, for example,
+
+example(LPAR()mycmd =(myoutput)RPAR() &!)
+
+as the forked subshell will wait for the command to finish then remove
+the temporary file.
+
texinode(Parameter Expansion)(Command Substitution)(Process Substitution)(Expansion)
sect(Parameter Expansion)
cindex(parameter expansion)
@@ -1992,15 +2011,16 @@ point on.
)
item(tt(c)var(N)tt(,)var(M))(
The flag tt(LPAR()#c)var(N)tt(,)var(M)tt(RPAR()) can be used anywhere
-that the tt(#) or tt(##) operators can be used; it cannot be combined
-with other globbing flags and a bad pattern error occurs if it is
-misplaced. It is equivalent to the form tt({)var(N)tt(,)var(M)tt(}) in
-regular expressions. The previous character or group is required to
-match between var(N) and var(M) times, inclusive. The form
-tt(LPAR()#c)var(N)tt(RPAR()) requires exactly tt(N) matches;
-tt(LPAR()#c,)var(M)tt(RPAR()) is equivalent to specifying var(N) as 0;
-tt(LPAR()#c)var(N)tt(,RPAR()) specifies that there is no maximum limit
-on the number of matches.
+that the tt(#) or tt(##) operators can be used except in the expressions
+`tt((*/)#)' and `tt((*/)##)' in filename generation, where `tt(/)'
+has special meaning; it cannot be combined with other globbing flags and
+a bad pattern error occurs if it is misplaced. It is equivalent to the
+form tt({)var(N)tt(,)var(M)tt(}) in regular expressions. The previous
+character or group is required to match between var(N) and var(M) times,
+inclusive. The form tt(LPAR()#c)var(N)tt(RPAR()) requires exactly tt(N)
+matches; tt(LPAR()#c,)var(M)tt(RPAR()) is equivalent to specifying var(N)
+as 0; tt(LPAR()#c)var(N)tt(,RPAR()) specifies that there is no maximum
+limit on the number of matches.
)
item(tt(m))(
Set references to the match data for the entire string matched; this is
@@ -2360,8 +2380,8 @@ latter is inserted into the command line word by word.
For example, suppose a directory contains a single file `tt(lonely)'. Then
the expression `tt(*(e:'reply=(${REPLY}{1,2})':))' will cause the words
-`tt(lonely1 lonely2)' to be inserted into the command line. Note the
-quotation marks.
+`tt(lonely1)' and `tt(lonely2)' to be inserted into the command line. Note
+the quoting of var(string).
The form tt(PLUS())var(cmd) has the same effect, but no delimiters appear
around var(cmd). Instead, var(cmd) is taken as the longest sequence of