This is a small script to check if two given files permissions are same or not
#!/bin/bash
#Purpose: To check two given files are having same permissions or not
#Author: Surendra Anne(surendra@linuxnix.com)
#Date:2012-04-24
#Modified:::
read -p “Enter two files with their paths” FILE1 FILE2
PERM1=$(stat –printf=”%a” $FILE1)
PERM2=$(stat –printf=”%a” $FILE2)
if [ $PERM1 -eq $PERM2 ]
then
echo “Both the files have same permissions: $PERM1”
else
echo “The given files have different permissions”
fi
Some of the tools used here are
read command
Command substitution
stat command
square brackets
if statement
#!/bin/bash
#Purpose: To check two given files are having same permissions or not
#Author: Surendra Anne(surendra@linuxnix.com)
#Date:2012-04-24
#Modified:
read -p “Enter two files with their paths” FILE1 FILE2
PERM1=$(stat –printf=”%a” $FILE1)
PERM2=$(stat –printf=”%a” $FILE2)
if [ $PERM1 -eq $PERM2 ]
then
echo “Both the files have same permissions: $PERM1”
else
echo “The given files have different permissions”
fi
Some of the tools used here are
read command
Command substitution
stat command
square brackets
if statement
The following two tabs change content below.
Mr Surendra Anne is from Vijayawada, Andhra Pradesh, India. He is a Linux/Open source supporter who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. He works as Devops Engineer with Taggle systems, an IOT automatic water metering company, Sydney . You can contact him at surendra (@) linuxnix dot com.
Latest posts by Surendra Anne (see all)
- Docker: How to copy files to/from docker container - June 30, 2020
- Anisble: ERROR! unexpected parameter type in action:
Fix - June 29, 2020 - FREE: JOIN OUR DEVOPS TELEGRAM GROUPS - August 2, 2019
- Review: Whizlabs Practice Tests for AWS Certified Solutions Architect Professional (CSAP) - August 27, 2018
- How to use ohai/chef-shell to get node attributes - July 19, 2018