I just want to ask if you have an idea on how to sort files by date in bash script?
I have a bash script but i don't know how to put sort command on it.
Here is my script below:
echo "LAST BACKUP: "
for file in `dir -d *`;
s=`echo $file | cut -c 6-12` #extract the date on the file
if [ $s = "$DATESTRING" ]; then
echo "BACKUP SUCCESSFULLY"
echo "No Backup: $DATESTRING"
Your help is very much appreciated.