Re: BASH and wildcard expansion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Around 07:56pm on Monday, August 19, 2013 (UK time), Mark Haney scrawled:

> 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?

Not sure I totally understand what the problem is, but I think if I were
doing what I think you may be trying to do, I'd consider using the find
command.

Steve

-- 
 
Website:  www.stevesearle.com

 19:58:18 up 38 days, 23:30,  1 user,  load average: 0.00, 0.01, 0.00

Attachment: pgpR_LFrz5n0U.pgp
Description: PGP signature

-- 
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
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux