Dear All,
I have a input file containing all the rolnos of 400 studenst. I have written a
small perl script to create their home directories in the cluster server.
everything worked fine except for the reason that, it shows up error message
indicating that the following messages for example:
when my input file rr.txt contains the following roll nos.:-
s08-1-5-095
s08-1-5-096
s08-1-5-097
the error messages displayed are :-
[EMAIL PROTECTED] perl]# perl h20.pl
chgrp: invalid group `s08-1-5-095'
chgrp: invalid group `s08-1-5-096'
chgrp: invalid group `s08-1-5-097'
The ls -l listing shows up the following :-
drwx------ 2 s08-1-5-095 root 4096 2008-08-20 17:28 s08-1-5-095
drwx------ 2 s08-1-5-096 root 4096 2008-08-20 17:28 s08-1-5-096
drwx------ 2 s08-1-5-097 root 4096 2008-08-20 17:28 s08-1-5-097
As shown above the group is shown as root, but i want each student to be the
group itself, for example it should be :
drwx------2 s08-1-5-095 s08-1-5-095 4096 2008-08 17:28
s08-1-5-095
The perl script is shown below:
Can anyone tell me what changes should I make in the script so as to make the
group same as owner i.e., the roll no. itself.
#!/usr/local/bin/perl
$file = '/root/perl/rr.txt';
open(PWD, $file);
while(<PWD>)
{
($a)=split(/\s+/,$_);
#system("mkdir /root/perl/$a");
system("chmod 700 /root/perl/$a");
#system("chown /root/perl/$a $a");
system("chgrp $a /root/perl/$a" );
}
close(PWD);
~
Thanks,
Jyotishmaan Ray Moderator Of Paradise Groups
http://yahoogroups.com/group/Spirituality-Paradise Are You Spiritually Aware
!!! Are You Enjoying Yourself !!! See What All You Had Been Missing !!!!
Please Join Immediately By Sending A Blank Mail @
[EMAIL PROTECTED]