Write a short script that tells you whether the permissions for two files, whose names are given as arguments to the script, are identical. If the permissions for the two files are identical, output the common permission field. Otherwise, out- put each filename followed by its permission field. (Hint: Try using the cut utility.)

What will be an ideal response?

The following code is the heart of this script. As always, you must specify
a shell and check the arguments.
$ cat permcomp
perm1=$(ls -l $1 | cut -d" " -f1)
perm2=$(ls -l $2 | cut -d" " -f1)
if [ $perm1 == $perm2 ]
then
echo $perm1
else
echo $perm1 $1
echo $perm2 $2
fi

Computer Science & Information Technology

You might also like to view...

What is RIPng, and what is it used for?

What will be an ideal response?

Computer Science & Information Technology

Using a check box form control allows a user to choose only one item from the list.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology