[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: The "*" character (was: Latex )



Mark,

When using wildcards in bash, the shell attempts to expand them, but 
if it finds nothing that matches the specified pattern, it passes the 
wildcard string to the command. Quoting the wildcard pattern causes 
the shell to pass it as a single argument to the command. 

In your case, since there was no file in the directory you were 
executing from that matched the pattern *tex*, bash behaved as if you 
had quoted the pattern.

Since I don't use tcsh, I couldn't say for certain, but my 
understanding is that it treats wildcards in a slightly different 
manner - always attempting the expansion and returning an error 
message if the no matches are found. To pass an argument containing 
wildcards, the pattern must be quoted. This would explain why:

bash$ dpkg -l *tex*   

worked, and:

tcsh% dpkg -l *tex* 

did not.

In any case, as a matter of good style, you should always quote 
wildcards when you don't want them expanded - even if you know you 
can get away without it. 

Hope this clarifies things...

Gerry



Reply to: