comparison lispref/files.texi @ 51793:ccbf5ac3316d

(File Name Expansion): Warn about iterative use of substitute-in-file-name.
author Richard M. Stallman <rms@gnu.org>
date Mon, 07 Jul 2003 20:48:26 +0000
parents 24b62b8f3def
children 3abc365e9d90
comparison
equal deleted inserted replaced
51792:8896f8091409 51793:ccbf5ac3316d
1807 @end example 1807 @end example
1808 @end defvar 1808 @end defvar
1809 1809
1810 @defun substitute-in-file-name filename 1810 @defun substitute-in-file-name filename
1811 This function replaces environment variables references in 1811 This function replaces environment variables references in
1812 @var{filename} with the environment variable values. Following standard 1812 @var{filename} with the environment variable values. Following
1813 Unix shell syntax, @samp{$} is the prefix to substitute an environment 1813 standard Unix shell syntax, @samp{$} is the prefix to substitute an
1814 variable value. 1814 environment variable value. If the input contains @samp{$$}, that is
1815 converted to @samp{$}; this gives the user a way to ``quote'' a
1816 @samp{$}.
1815 1817
1816 The environment variable name is the series of alphanumeric characters 1818 The environment variable name is the series of alphanumeric characters
1817 (including underscores) that follow the @samp{$}. If the character following 1819 (including underscores) that follow the @samp{$}. If the character following
1818 the @samp{$} is a @samp{@{}, then the variable name is everything up to the 1820 the @samp{$} is a @samp{@{}, then the variable name is everything up to the
1819 matching @samp{@}}. 1821 matching @samp{@}}.
1822
1823 Calling @code{substitute-in-file-name} on output produced by
1824 @code{substitute-in-file-name} tends to give incorrect results. For
1825 instance, use of @samp{$$} to quote a single @samp{$} won't work
1826 properly, and @samp{$} in an environment variable's value could lead
1827 to repeated substitution. Therefore, programs that call this function
1828 and put the output where it will be passed to this function need to
1829 double all @samp{$} characters to prevent subsequent incorrect
1830 results.
1820 1831
1821 @c Wordy to avoid overfull hbox. --rjc 15mar92 1832 @c Wordy to avoid overfull hbox. --rjc 15mar92
1822 Here we assume that the environment variable @code{HOME}, which holds 1833 Here we assume that the environment variable @code{HOME}, which holds
1823 the user's home directory name, has value @samp{/xcssun/users/rms}. 1834 the user's home directory name, has value @samp{/xcssun/users/rms}.
1824 1835