So what I have is 2 directories that have the same files, except that directory a is today's data and directory b is yesterday's data. What I want to do is compare the files and output the results into 3 columns, which will be the file name, whether or not the files are identical, and how many days the files have been the same. What I have so far is:ls ./dropzone_current > files.txtis_identical=falsefilename=files.txtwhile read -r linedo    name=$line    declare -i counter     diff -qs ./dropzone_current/$name ./dropzone_backup/$name    if [ $? -ne 0 ]    then    is_identical=false    counter=0    printf '%s\t%s\t%s\n' $name $is_identical $counter >> test.txt    else    counter=$((counter + 1))    is_identical=true    printf '%s\t%s\t%s\n' $name $is_identical $counter >> test.txt    fidone < $filenameEssentially, everything works except the counter. I need the counter to be unique to each file name that's being compared, and then update every time the script is run (once a day) but I haven't been able to figure out how to do that.
How do I get a counter variable to be unique for each line of a file
bash
Based on comments to my other answer and to your question, it sounds like what you're really looking for is a way to track changes to a set of files.  This is commonly known as version (or revision) control.  One common engine for this that is generally installed on a system is git.  To implement this, pick a location to store what we'll call the 'repository', which will store a copy of the files and track all of the changes thereto.  We'll call this location /path/to/repository.  Create that directory, and run the command git init.  This will set up the repository.  Copy the files into the directory, and we will now 'commit' the current state to the repository:git add *git commit -m Initial commit of filesThen, you can simply watch the delivery location and update the repository as needed:#!/bin/bashrepo='/path/to/repository'dropbox='/path/to/delivery/'cd $repofor file in *; do    if ! diff ${repo}/$file ${dropbox}/$file; then        cp -p ${dropbox}/$file ${repo}/        git add $file    fidonegit commit -m Update for $(date)This is a quick-and-dirty script that doesn't handle files with spaces in their names, or files being added or removed from the feed particularly well, but it's a place to start.