Skip to content

Instantly share code, notes, and snippets.

@tuxnker
Created February 27, 2016 09:48
Show Gist options
  • Save tuxnker/9b3ca07b72c3ba1afcda to your computer and use it in GitHub Desktop.
Save tuxnker/9b3ca07b72c3ba1afcda to your computer and use it in GitHub Desktop.
#!/bin/bash
_APP_PATH=('/home/user1' '/home/user2' '/home/user3')
_PERM=('755' '740' '740')
aLen=${#_APP_PATH[@]}
pLen=${#_PERM[@]}
if [ ${aLen} != ${pLen} ];then
echo "folder and permisons array don't match "
exit 1
fi
function get_perm {
stat -c "%a" $1
}
function verify_perm {
existing_perm=$(get_perm $1)
if [ $existing_perm == $2 ]; then
echo "$1: permisions match"
else
echo "$1: has permisions $existing_perm but expected $2 instead"
fi
}
for (( i=0; i<${aLen}; i++ ));do
verify_perm ${_APP_PATH[$i]} ${_PERM[$i]}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment