Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Need a Unix routine to list files by wildcards (*file*)

Posted on 2004-09-14
3
272 Views
Last Modified: 2010-04-21
If I execute under Unix an application (let's say written in C) and pass something like *.pat in on the command line then the argv's I actually see in the C program are already parsed into the individual files.  Is there a stand-alone system command that does this, maybe something I could call from within the C program?
0
Comment
Question by:jimdgar
  • 2
3 Comments
 
LVL 48

Expert Comment

by:Tintin
ID: 12060426
What you are describing is shell globbing, ie:  the shell is expanding any of the patterns *before* it is parsed to the program.
0
 

Author Comment

by:jimdgar
ID: 12060657
I understand.  The question is whether the function which does the expansion can be called separately.
0
 
LVL 48

Accepted Solution

by:
Tintin earned 50 total points
ID: 12060856
man 3 glob
man 3 globfree

Depending on what Unix flavour you have, you may need to adjust the man section.  

Do a

man -k glob

if you have no luck with the above.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question