hubertf's NetBSD Blog
Send interesting links to hubert at feyrer dot de!
[20101203] Hey NetBSD, got a match?
Here's one from the "get to know your shell" department. And of course I'm talking about the only real shell, (t)csh. So... let's first make sure we are in (t)csh. Of course the '%' prompt tells that, but just to be sure:
% echo $SHELL
% hey netbsd, got a match?
hey: No match. 
Funny? Well. We all know that joke - it originates in the One True Shell trying to expand the '?' wildcard, and fails to find any files in the current directory that match any file that starts with the string "match", followed by a single random character. As a result: "No match".

This joke doesn't work in (ba)sh as those do return the unexpanded pattern by default (try it: echo foo?bar*baz). To get the same behaviour in interactive (t)csh, Christos gave this hint on one of the mailing lists: "set nonomatch" will stop complaints if there's no wildcard match, and the shell will then just return the input string as expanded result:

% set nonomatch
% hey netbsd, got a match?
hey: Command not found.
% echo foo?bar*baz
Neat, hu?

[Tags: , ]

Disclaimer: All opinion expressed here is purely my own. No responsibility is taken for anything.

Access count: 35483764
Copyright (c) Hubert Feyrer