Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: checking for file existence when I don't know the exact name



2011/10/24 TJ Luoma <luomat@xxxxxxxxx>:
> 2011/10/24 Jérémie Roquet <arkanosis@xxxxxxxxx>
>> From the man, section “conditional expressions” :
>>
>>  “File generation is not  performed on any form of argument to
>> conditions.”
>
> This isn't file _generation_, is it? Or am I not understanding zsh's terms?

Err, it's file*name* generation, actually. In zsh's terms, filename
generation refers to globbing.

Peter, maybe we should fix the doc there?

> I still don't fully understand why / when to use [[ ]] instead of [ ]

Most of the time, I guess. [[ ]] is part of the syntax and has a
number of advanced features while [ is just a command very similar to
“test” and ] an argument to this command.
Unless you want to keep your scripts portable accross different
shells, of course.

Best regards,

-- 
Jérémie

diff --git a/Doc/Zsh/cond.yo b/Doc/Zsh/cond.yo
index 489ee35..71971b4 100644
--- a/Doc/Zsh/cond.yo
+++ b/Doc/Zsh/cond.yo
@@ -184,7 +184,7 @@ enditem()
 Normal shell expansion is performed on the var(file), var(string) and
 var(pattern) arguments, but the result of each expansion is constrained to
 be a single word, similar to the effect of double quotes.
-File generation is not performed on any form of argument to conditions.
+Filename generation is not performed on any form of argument to conditions.
 However, pattern metacharacters are active for the var(pattern) arguments;
 the patterns are the same as those used for filename generation, see
 ifzman(\



Messages sorted by: Reverse Date, Date, Thread, Author