I'm writing a shell script to automate the restore of a database backup. As part of this I need to know the name of the directory conataining the backup files. However this will change every time.
How can I get the directory name into a variable for reference later on.
example: I have the basic directory:
/var/backups/db/
In here there will be another directory, whose name will change every time (e.g. /var/backups/db/db_backup_109245_abc/)
How can I get the directory name (e.g. db_backup_109245_abc) including the full path into a variable so I can refer to it later on?
There will only ever be one directory in here (an earlier part of the process guarantees that), and the name of that directory will vary every time.