Hi,
My script to add a new user is below, written on solaris 10.
Running it using either of these two ways (one with double quotes
around the second parameter and one with single quotes):
./adduser.sh TestAcct "John Smith" Law
./adduser.sh TestAcct 'John Smith' Law
My script thinks I have entered four parameters.
But when I run it using the following (with no embedded spaces):
./adduser.sh TestAcct JohnSmith Law
It then thinks I have entered three parameters.
How do I get a parameter that has embedded spaces to register as just
one parameter??
Thanks for any help,
Regina
Regina Miller
Lead Analyst, Grays Harbor County
(360) 249-4144 ext 457
rmiller@...
MY SCRIPT
eval "exec ctperl -S $0 $*"
if $running_via_sh;
#$Id: adduser.sh,v 302.4 1995/07/21 16:29:18 nick Exp $
#require 'ctree.pl';
########################################################################
########
# %perl
# %width 80
# %title Add a New User
# %name adduser.sh
use strict;
use warnings;
die 'Usage: adduser username "full name" group. i.e. adduser testacct
"John Smith" Law'
unless @ARGV == 3;
unless (system "useradd -g $ARGV[2] -d /home/$ARGV[0] -m -s /usr/bin/ksh
-c $ARGV[1] $ARGV[0]")
{
system "passwd $ARGV[0]";
exit;
}
print "Error. User can not be added\n";
[Non-text portions of this message have been removed]