Home Linux Write a shell script that displays the directory information in the following formt.

Write a shell script that displays the directory information in the following formt.

1 min read
0
0
63

Write a shell script that displays the directory information in the following format.

Filename            Size          Date          Protection         Owner


x=`ls -l | wc -l`

i=2

echo "Filename\t\t\tSize\tDate\tProtection\tOwner\n"

while [ $i -le $x ]

do

s=`ls -1 | head -$i | tail -l | tr -s " "`

fn=`echo $s | cut -d " " -f 9`

si=`echo $s | cut -d " " -f 5`

d1=`echo $s | cut -d " " -f 6`

d2=`echo $s | cut -d " " -f 7`

p=`echo $s | cut -d " " -f 1`

o=`echo $s | cut -d " " -f 3`

echo "$fn\t\t\t$si\t$d1 $d2\t$p\t$o"

i=`expr $i + 1`

done

Load More Related Articles
Load More By coder coder
Load More In Linux

Leave a Reply

Your email address will not be published. Required fields are marked *

Check Also

Prime Or Not Prime vb.net Program.

Prime Or Not Prime . …