Advertisement
Guest User

Untitled

a guest
Jun 21st, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.55 KB | None | 0 0
  1. IFS_OLD=$IFS; IFS=$'\n'
  2. echo -n "Backing-up file permissions ... "
  3.  
  4. DIRS=()
  5.  
  6. for FILE in `git ls-files`
  7. do
  8.    # Save the permissions of all files in the index
  9.    echo $FILE";"`stat -c "%a;%U;%G" $FILE` >> $DATABASE
  10.    FILE_DIR=$(dirname "$FILE")
  11.    if ! [[ " ${DIRS[@]} " =~ " ${FILE_DIR} " ]]; then
  12.       DIRS+=("$FILE_DIR");
  13.    fi
  14. done
  15.  
  16. echo -n "and directory permissions ... "
  17. for DIR in "${DIRS[@]}"
  18. do
  19.    # Save the permissions of all directories in the index
  20.    echo $DIR";"`stat -c "%a;%U;%G" $DIR` >> $DATABASE
  21. done
  22.  
  23. IFS=$IFS_OLD
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement