From d6ed3c5bce84e611c8a8b9c9fcbb6796ab1ad2a2 Mon Sep 17 00:00:00 2001 From: Peter Wood Date: Wed, 5 Mar 2025 22:00:49 +0000 Subject: [PATCH] added script to update .zshrc from dotfiles if newer --- update-zsh.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 update-zsh.sh diff --git a/update-zsh.sh b/update-zsh.sh new file mode 100755 index 0000000..ab902d5 --- /dev/null +++ b/update-zsh.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Define the paths to the source and destination files +source_file="/home/acedanger/dotfiles/.zshrc" +destination_file="/home/acedanger/.zshrc" + +# Get the modification times of the source and destination files +source_mtime=$(stat -c %Y "$source_file") +destination_mtime=$(stat -c %Y "$destination_file") + +# Compare the modification times +if [ "$source_mtime" -gt "$destination_mtime" ]; then + echo "Updating '$destination_file' with '$source_file'..." + cp "$source_file" "$destination_file" + # source $destination_file + echo "The ~/.zshrc has been updated and the changes are now active." +fi + +exit 0