-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ok, so I tried to make a simple script to add users so I wouldn't have
to type in groups/pw over and over again... the problem is that it's not
behaving like it should =o.

Script:
#!/bin/tcsh -x
#

if ( ( $# != 0 ) ) {

        set GROUPS="";
        set USER="";

        if( ( $# == 2 ) ) {

                set USER=$1;
                set GROUPS=$0;

                switch($0)

                        case "-v":
                                set GROUPS="-G vip";
                                breaksw

                        case "-w":
                                set GROUPS="-G vip,wheel";
                                breaksw
                        default:
                                echo "bad argument(s) specified!";
                                exit(1);

                endsw

        } else if($# == 1) {
                set USER=$0;
        } else {
                echo "bad # of args; exiting..";
        }

        `pw add user -N -d /home/$USER -s /usr/local/bin/bash $GROUPS
$USER && mkdir /home/$USER && ln -s /home/dud.bash_login
/home/$USER/.bash_login`;

} else {
        print "Usage [-r|-v|-w] username"
}

Output:
[EMAIL PROTECTED] ~]# ./mkuser
if ( ( 0 != 0 ) ) {
set GROUPS=
set USER=
if ( ( 0 == 2 ) ) {
set USER=
set GROUPS=./mkuser
switch ( ./mkuser )
echo bad argument(s) specified!
bad argument(s) specified!
exit ( 1 )

        Basically it should drop out at the first if statement due to 0 != 0
being true and go straight to the else block, but it's falling through
to the switch statement. Any ideas?

        Also..

[EMAIL PROTECTED] /home/gcooper]# tcsh --version
tcsh 6.14.00 (Astron) 2005-03-25 (i386-intel-FreeBSD) options
wide,nls,dl,al,kan,rh,color,filec

        Thanks!

- -Garrett
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFPwXc6CkrZkzMC68RAo4sAJ9LOcJ6xnjTo2pWF8W6nOjqXqjfmACeP9OC
WQWFzBpbKca+kkdT1APlo3k=
=G6sT
-----END PGP SIGNATURE-----
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to