-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathbackup.sh
More file actions
executable file
·23 lines (23 loc) · 799 Bytes
/
backup.sh
File metadata and controls
executable file
·23 lines (23 loc) · 799 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env bash
if grep -q $'\r' "$0"; then
# Script has CRLF, try to fix it
if command -v dos2unix &>/dev/null; then
dos2unix "$0"
elif [[ "$(uname)" == "Darwin" ]] && command -v gsed &>/dev/null; then
gsed -i 's/\r$//' "$0" # Use gsed on macOS if available
elif [[ "$(uname)" == "Darwin" ]]; then
sed -i '' 's/\r$//' "$0" # Use BSD sed on macOS
else
sed -i 's/\r$//' "$0" # Use GNU sed on Linux
fi
# Re-execute the script with the corrected line endings
exec bash "$0" "$@"
fi
# Made By M3TOZZ
BACKUP_DIR="Backup-$(date +%Y-%m-%d-%H:%M:%S)"
echo -e "\033[0;31mBacking Up...\033[1;36m"
mkdir -p "$BACKUP_DIR"
cp -r ~/.config/fastfetch "$BACKUP_DIR/"
clear
echo -e "\033[31m Backed Up!\033[0m"
echo "Saved to: $(pwd)/$BACKUP_DIR"