3131
3232Mandatory arguments to long options are mandatory for short options too.
3333 -a, --all do not ignore entries starting with .
34- -o like -l, but do not list group information
34+ -g like -l, but do not list owner
3535 -1 list one file per line
3636 -n, --numeric-uid-gid like -l, but list numeric user and group IDs
37+ -o like -l, but do not list group information
3738 -r, --reverse reverse order while sorting
3839 --help display this help and exit
3940 --version output version information and exit
5253 2 if serious trouble (e.g., cannot access command-line argument).
5354" ;
5455my ($all , $list , $reverse , $nogid , $numeric_uid_gid );
56+ my ($noowner );
5557
5658my $ret = GetOptions(
5759 ' l' => \$list ,
5860 ' n|numeric-uid-gid' => \$numeric_uid_gid ,
5961 ' all' => \$all ,
62+ ' g' => \$noowner ,
6063 ' o' => \$nogid ,
6164 ' reverse|r' => \$reverse ,
6265 ' help' => \&usage,
@@ -76,7 +79,7 @@ sub main {
7679 $ARGV [0] = getcwd();
7780 }
7881
79- if ($numeric_uid_gid ) {
82+ if ($numeric_uid_gid or $noowner ) {
8083 $list = 1;
8184 }
8285
@@ -131,6 +134,8 @@ sub listfile {
131134 # the -o option just like -l, no group id.
132135 if ($nogid ) {
133136 printf " %1s%9s %3d %8s %8d %12s" , $type , $right , $nlink , $uid , $size , $ctime ;
137+ } elsif ($noowner ) {
138+ printf " %1s%9s %3d %8s %8d %12s" , $type , $right , $nlink , $gid , $size , $ctime ;
134139 } else {
135140 printf " %1s%9s %3d %8s %8s %8d %12s" , $type ,$right ,$nlink ,$uid ,$gid ,$size ,$ctime ;
136141 }
@@ -186,6 +191,8 @@ sub listdir {
186191 # the -o option just like -l, no group id.
187192 if ($nogid ) {
188193 printf " %1s%9s %3d %8s %8d %12s" , $type , $right , $nlink , $uid , $size , $ctime ;
194+ } elsif ($noowner ) {
195+ printf " %1s%9s %3d %8s %8d %12s" , $type , $right , $nlink , $gid , $size , $ctime ;
189196 } else {
190197 printf " %1s%9s %3d %8s %8s %8d %12s" , $type ,$right ,$nlink ,$uid ,$gid ,$size ,$ctime ;
191198 }
0 commit comments