Replace parsed `ls` with `stat` - less portable, but safe

This commit is contained in:
Janek Bevendorff 2015-03-19 19:27:36 +01:00
parent 75d2c11ace
commit f3182973d9
1 changed files with 1 additions and 1 deletions

View File

@ -55,7 +55,7 @@ for home_dir in "${BACKUP_ROOT}"/*; do
fi
cd "${home_dir}/${FILES_DIR}"
owner=$(ls -ld "${home_dir}/${FILES_DIR}" | awk '{ print $3 }')
owner=$(stat -c '%U' .)
su - "${owner}" -c "rsnapshot -c '${home_dir}/rsnapshot.conf' '$1'"
fi