[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CAFf+5zix1c=mfUBWW2tiz7KkNsPmPOBgmFcHZd8HLtOVn3sAGw@mail.gmail.com>
Date: Thu, 8 Jan 2026 10:54:02 +0530
From: Amit <amitchoudhary0523@...il.com>
To: linux-kernel@...r.kernel.org
Subject: Bash scripts for taking backups of files and comparing the current
file with the latest backed up version of the file.
Bash scripts for taking backups of files and comparing the current
file with the latest backed up version of the file.
-------------------
mybackup.sh
-------------------
--------------------------------------------------------------------------------------------
#!/bin/bash
backup_dir=~/backups
date=`date "+%Y-%m-%d-%H-%M-%S"`
set -x
cp $1 $backup_dir/$1.$date
--------------------------------------------------------------------------------------------
Example usage: mybackup.sh myfile.c
-------------------------------------------------------------------
compare_file_with_lastest_backed_up_version.sh
-------------------------------------------------------------------
--------------------------------------------------------------------------------------------
#!/bin/bash
ls -tr -1 ~/backups/$1.*
last=`ls -tr -1 ~/backups/$1.* | tail -n 1`
echo
set -x
diff -u $last $1
--------------------------------------------------------------------------------------------
Example usage: compare_file_with_lastest_backed_up_version.sh myfile.c
----
Powered by blists - more mailing lists