ot, a programming question

Charles Hallenbeck chuckh at mhonline.net
Sat Dec 22 06:42:39 EST 2001


Another way to illustrate that it is the shell that expands the
wildcards is to use single quotes to prevent it from happening,
so that a wildcard is passed to the application instead of being
seen by the shell. Try this for instance:

mpg123 '*.mp3'

and the application will not be able to find the file whose name
contains the star!

In the bad old days (under DOS) the Borland C++ libraries had a
linkable module called "wildargs.obj" and if your program linked
with that module it would behave just like a Linux application
does with the shell expansion. Later versions of Borland
compilers abandoned this module and expected programmers to use
calls to "findfirst" and "findnext" to yield the names that
matched the wildcards. In Linux the expansion of wildcards is
_USUALLY the job of the shell.

HTH - Chuck


On Sat, 22 Dec 2001, Geoff Shang wrote:

> Hi:
>
> The shell expands the wildcard, the wildcard itself never gets passed to
> the application.  This can be demonstrated by the following script:
>
> #!/bin/sh
> echo $1 $2 $3 $4 $5
>
> Now, you can see here that it's important to read the correct number of
> parameters.  Running this script will only output the first 5 matching
> files, so you need to be able to read in all the names.  I don't know how
> you'd do this in a shell script, but it'd be easy in say C.
>
> Geoff.
>
>
>
> _______________________________________________
> Speakup mailing list
> Speakup at braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup
>

Visit me at http://www.mhonline.net/~chuckh
The Moon is Waxing Crescent (46% of Full)





More information about the Speakup mailing list