Skip to content

Instantly share code, notes, and snippets.

@hotta
Created March 21, 2024 05:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hotta/5c72be047397cd6bcc4e937ccc7a5041 to your computer and use it in GitHub Desktop.
Save hotta/5c72be047397cd6bcc4e937ccc7a5041 to your computer and use it in GitHub Desktop.
指定したユーザーのドットファイルをまとめて収集する。
#!/bin/bash
# Gather dotfiles of specified users.
ARC=/tmp/dotfiles.tar
USERS=(user1 user2 user3)
sudo sh -c "tar cf $ARC /home/etl/.??*" || exit 1
for u in ${USERS[@]} ; do
echo $u
sudo sh -c "tar rf $ARC /home/$u/.??*" || exit 1
done
sudo gzip $ARC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment