I'm wanting to write a bourne shell script that takes in two command line arguments - a directory and a file. With this I want to return a list of files within the directory that are older (based on creation date) than the given file, and print the number of files that have not been listed (they are newer than the given file).
I've never used bourne before so I'm hoping someone could help me out with a few tips on how I'd go about this. I've been thinking it will need an if statement that will separate those older files from the newer ones and update a count of the newer ones? But I'm unsure about how to work with the dates and such.
I've written a little mock up, that I know isn't correct but would something like this come anywhere close to working?
#!/bin/sh
directory = $1
file = $2
count = 0
for f in $directory
do
if [ "$f" �ot "$file"]; then
echo "$f"
count='expr $count + 1'
fi
done
echo "There are $x newer files"
Any help would be greatly appreciated!
Thanks!