That's what I missed. I used the wrong single quotes ' instead of `. Git. Should've caught that right off. It's been a while since I had a chance to script anything in bash, since I've worked mostly in Windows the last year or so and I'm rusty. Thanks.
On Aug 19, 2013 6:18 PM, "Bill Oliver" <vendor@xxxxxxxxxxxxx> wrote:
On Mon, 19 Aug 2013, Mark Haney wrote:
I've hit a problem I can't quite figure out which a bash script I'm writing. I'm trying to copy backup files in the format 2013-August-18--1123.zip to an NFS share.
I want to have the script copy the file with just the date. In bash I've setup vars that get the current date:
# Date variables
log_year=`date "+%Y"`
log_month=`date "+%B"`
log_day=`date "+%d"`
# Filename format YYYY_MM_DD--HHMM.zip
filename=$log_year"-"$log_month"-"$log_day"--"/*".zip"
The problem is I don't really care about the stuff after the '--'. I.e. from the CLI I'd just 'ls 2013-August-18--*.zip' to get all the files with that date in the
file name. How can I do that in a bash script?
--
Caesar si viveret, ad remum dareris.
Mark Haney
Software Developer/Consultant
mark.haney@xxxxxxxxx
You mean something like this?
************************
#!/bin/sh
# Date variables
log_year=`date "+%Y"`
log_month=`date "+%B"`
log_day=`date "+%d"`
# Filename format YYYY_MM_DD--HHMM.zip
filename="$log_year-$log_month-$log_day--*.zip"
filelist=`ls $filename`
echo $filelist
***************************
billo
--
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org
-- users mailing list users@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org