Evan N Mr Niso/Lockheed Martin Kehayias wrote:
>
> Greetings,
Hello,
> I am attempting to limit entries a user could make when inputting names into
> one of my scripts. I prompt the user to enter one or more names. One name
> is easy to isolate but when there are more I want to support commas. At the
> same time I don't want to accept anything other than names and commas. I
> want to force the user to either enter names correctly or exit. For that
> matter it would be really cool if I could test the names against
> /etc/passwd.
You can.
$ perl -le'
if ( defined( getpwnam( $ARGV[0] ) ) ) {
print "$ARGV[0] found";
}
else {
print "$ARGV[0] NOT found";
}
' root
root found
$ perl -le'
if ( defined( getpwnam( $ARGV[0] ) ) ) {
print "$ARGV[0] found";
}
else {
print "$ARGV[0] NOT found";
}
' fred
fred NOT found
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]