Shell script that accepts 2 file names and check if the permission for these files are identical & if the permissions are identical o/p the common permission otherwise o/p each file name followd by its permission


#!/bin/sh
P1=`ls –l $1|cut –c 1-10`

P2=`ls -l $2|cut -c 1-10`

If [ $p1 = $p2 ]

Then

Echo “file permissions are same”

Echo “file permission is $p1”

Else

Echo “file permissions are different”

Echo “$1 has file permission $p1”

Echo “$2 has file permission $p2”

Contributed by : Sri Raksha

Comments