BASH and wildcard expansion

g geleem at bellsouth.net
Tue Aug 20 16:46:42 UTC 2013


hello reberto,

On 08/20/2013 08:33 AM, Roberto Ragusa wrote:
> On 08/19/2013 08:56 PM, 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"`
>
> Partially offtopic hint:
>
> avoid multiple date invocations, you can get wrong results at the midnight
> of the last day of the month
> (and it's much worse when doing hours,minutes,seconds).
>
> Just do:
>
> log_ymd=`date +%Y-%B-%d`

or, op can use date form as;

   find $1 -depth | sort | cpio -o -Bcv > \
    /home/users/hold/0000.0001.cpio2file/$2.cpio 2> \
    /home/users/hold/0000.0001.cpio2file/$2.err-list.`date +%Y.%m%d.%H%M.%S`

to sort by month's in numerical and not all mixed up, which is why i
prefer using number for month.


-- 

peace out.

in a world with out fences, who needs gates.

sl6.3 linux

tc.hago.

g
.



More information about the users mailing list