in reply to Detect * in arguments

Code is worth 1000 words; please include input, output and code (or pseudocode) for future questions. See How do I post a question effectively?

Finding out whether a string contains a certain character can be done with index or regular expressions. In your case, maybe your check would look like:

if (index($args, '*') != -1) { die "No * are allowed.\n" }
or maybe you'd strip it using
$args =~ s/\*//g;
If these don't fit the bill, provide more algorithmic clarity, and I can be more helpful.

Update: Or do you mean the shell is expanding the '*' metacharacter before it gets fed to your code? In this case, your code never sees the asterisk, and the hassle in protecting the user from themself is almost assuredly not worth your time.


#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.