clue:
midnight = 00
ten = 10
1 am = 1
you are probably getting spaces for the single digits in the filename.
like
Code:
mysqldump --all-databases > /home/nsuser/mysqlbackup/mysqldump_2005-01- 1.sql
homey is right, construct the file name first.
if there are spaces you will need to get rid of them
as they'll mess up your 'sort' of course.
you can use typeset (in ksh maybe bash?) to pad them with zeroes
e.g:
Code:
>typeset -Z5 num
>num=3
>echo $num
00003
hint: don't hardcode filenames and multiply redirect.
redirect once.
either use
Code:
# all lines after this default to the output file
exec 2>&1 > $OUTFILE_NAME
or put them in a function and redirect the function like
Code:
# function definition
do_it()
{
blah
blah/blah
echo done
}
do_it 2>&1 > $OUTFILE
never hardcode file names or such like. Use a variable that you can change in one place.