S
sfgroups
I have this code, its not getting unix command output into array.
Here is my code
perl code:
#!/usr/bin/perl
$user="myguest";
@m=( `id $user | perl -pne ' s/^.*gid//; s/[^\(]+\(([^\)]+)\)/"$1" /g;'
|perl -pne 's/"\s*"/", "/g' `);
print "size $#m \n";
foreach $s(@m) { print "$s\n";}
Here is output:
#./grp.plsize 0", " ", " ", " ", " ", " ", " ", " ", "
The command works in command line.
bash code:id myguest | perl -pne ' s/^.*gid//;
s/[^\(]+\(([^\)]+)\)/"$1" /g;' |perl -pne 's/"\s*"/", "/g'"myguest",
"myguest", "wheel", "mail", "games", "ftp", "users"
can you help me on this?
Thanks
SR
Here is my code
perl code:
#!/usr/bin/perl
$user="myguest";
@m=( `id $user | perl -pne ' s/^.*gid//; s/[^\(]+\(([^\)]+)\)/"$1" /g;'
|perl -pne 's/"\s*"/", "/g' `);
print "size $#m \n";
foreach $s(@m) { print "$s\n";}
Here is output:
#./grp.plsize 0", " ", " ", " ", " ", " ", " ", " ", "
The command works in command line.
bash code:id myguest | perl -pne ' s/^.*gid//;
s/[^\(]+\(([^\)]+)\)/"$1" /g;' |perl -pne 's/"\s*"/", "/g'"myguest",
"myguest", "wheel", "mail", "games", "ftp", "users"
can you help me on this?
Thanks
SR