Question: I am new to bash scripting and the part of my script below doesn't give me any output.

```
check=""
while [ "$check"=="" ]
do
    read -p "Signature Correct?(Yes/No): " check

if [ "$check" != "Y" || "$check" != "y" || "$check" != "Yes" || "$check" != "yes" || "$check" != "N" || "$check" != "n" || "$check" != "No" || "$check" != "no" ];
then
    check=""
elif ["$check" == "Y" || "$check" == "y" || "$check" == "Yes" || "$check" == "yes" ];
then
    echo "Signature Accepted!"
elif [ "$check" != "N" || "$check" != "n" || "$check" != "No" || "$check" != "no" ];
then
    check=""
fi
done

```

I don't get any error message. Any help with this? If you have a smarter or shorter solution, I would be grateful to benefit from the knowledge.

Thank you!

Answer: 
Assuming the structure of `date.txt` is always the same and the directory names don't contain newlines, something like this should do the trick:

```bsh
for d in /backups/*/date.txt; do
    printf '%s\t%s\n' "$(grep creation_time "$d")" "$(basename "$(dirname "$d")")"
done | sort | cut -f2-

```

Output:

```
full
incremental1
incremental2
incremental3

```

How to put this in an array should be fairly easy, but probably you won't need that as you could feed the result into e.g. a `while` loop or `xargs` or alike.
Working with the last-modified timestamp of the `date.txt` files in the `zsh` shell:

```none
for backupdir in /backup/*/date.txt(ome['REPLY=$REPLY:h']); do
    # do whatever you need to do
    # with the directory path in $backupdir
done

```

This uses a globbing pattern to match all the `date.txt` files. The globbing qualifier at the end of the pattern sorts the matches so that the most recently modified match is first (this is what `om` does), and removes the `/date.txt` string from the matching pathname (like `dirname` would do).

This is obviously assuming that the `date.txt` files were updated when the date was written to the file (at around the same time when the backup was made). This timestamp (as well as the directory timestamps) would be preserved if you copy the data using `rsync --archive`.

From `bash`:

```none
zsh -c '
for backupdir in /backup/*/date.txt(ome['\''REPLY=$REPLY:h'\'']); do
    # do whatever you need to do
    # with the directory path in $backupdir
done'

```