A wildcard problem

A wildcard problem

Post by Dimos Rapt » Tue, 28 Jan 1997 04:00:00



I face a small problem.  I hope you can help.

        I have created a program that unremoves files from a .trashcan
directory in my home directory.  This program takes filenames as
arguments.  However, I want it to take wildcards as well.  If I supply it
with a '*' then it will attempt to recover all the files in the cwd and
not the files located in the $HOME/.trashcan.  Suppose the command line is

# UNRM *

How can I make it so that argv[1] is assigned as '*' instead of the first
file in my cwd?

Thanks in advance!

 
 
 

A wildcard problem

Post by Paul D. Smi » Tue, 28 Jan 1997 04:00:00


You can't.

The shell will always expand wildcards before your program is ever even
invoked.  The only thing you can do is escape the wildcards:

  $ unrm \*

or

  $ unrm '*.c'

So the shell doesn't expand them.

If you're using csh, you can actually do this through some really
grotesque hackery in your .cshrc involving aliases, the noglobbing flag,
etc.  But the above works in every shell, regardless of .cshrc
settings.

--
-------------------------------------------------------------------------------

 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
     These are my opinions--Bay Networks takes no responsibility for them.

 
 
 

A wildcard problem

Post by frans bosm » Wed, 29 Jan 1997 04:00:00



> I face a small problem.  I hope you can help.

>         I have created a program that unremoves files from a .trashcan
> directory in my home directory.  This program takes filenames as
> arguments.  However, I want it to take wildcards as well.  If I supply it
> with a '*' then it will attempt to recover all the files in the cwd and
> not the files located in the $HOME/.trashcan.  Suppose the command line is

> # UNRM *

> How can I make it so that argv[1] is assigned as '*' instead of the first
> file in my cwd?

> Thanks in advance!

Your wildcard is expanded by the shell. To prevent this from happening,
you have to escape it:

$ UNRM \*
--
---------------------------------------------------------------------
Frans Bosma                     | Telephone: +31 50 5851267

DISCLAIMER: This statement is not an official statement from,
nor does it represent an official position of, PTT Telecom B.V.
---------------------------------------------------------------------

 
 
 

1. Wildcard DNS, Wildcard ServerName, Rewrite/Problems.

Hello all,

        I'm having some trouble with setting up a virtual system that points
all sublevel domains to a single file which does all the work. On a static
name, such as www.domain.com, the rules work, and the page is rewritten
properly, and the code works fine. When wildcarded, the server goes into an
endless loop of 302 redirects. Example:

DNS:

*       IN      A       128.0.0.1

<VirtualHost 128.0.0.1>
DocumentRoot /www/
ServerName *.domain.com
RewriteEngine On
RewriteOptions inherit
</VirtualHost>

Rules (inherited from primary host):

RewriteCond %{REMOTE_ADDR} .*
RewriteRule ^/robots.txt /www/robots.txt [L]

RewriteCond %{REMOTE_ADDR} .*
RewriteRule ^/(.*) http://%{HTTP_HOST}/engine/index.html [L]

Can anyone shed some light on how to fix this? I need to have the response
sent back as a 200, which is what it does when using a fixed name such as
www.domain.com.

Any help would be appreciated.

Thanks,

Mike

2. What is the best choice for video editing S/W?

3. mv problem : how to use wildcard function *,?

4. Problems getting Xfree86 to run correctly with an AMD 586

5. problems with VirtualHost and wildcard ServerAlias

6. BRU2000 not working under RedHat 5.1

7. eval and wildcard expansion problem

8. [v850] v850 entry / ptrace changes

9. MX record wildcard problem

10. tcsh wildcard problem

11. Wildcard in PATH ?

12. Rewrite with wildcards

13. deflector map wildcards?