emacs-bug-tracker
[Top][All Lists]
Advanced

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

[debbugs-tracker] bug#15407: closed (bug report)


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#15407: closed (bug report)
Date: Wed, 18 Sep 2013 16:26:03 +0000

Your message dated Wed, 18 Sep 2013 10:25:36 -0600
with message-id <address@hidden>
and subject line Re: bug#15407: bug report
has caused the debbugs.gnu.org bug report #15407,
regarding bug report
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
15407: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15407
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: bug report Date: Wed, 18 Sep 2013 14:07:22 +0100
Hi good afternoon

Yesterday i was reading the manual (man date) of the date command and I think that the option + and ' isn't refer on it

so i was trying to make this command on a script:

 $(date +'%Y-%m-%d '%H:%M:%S') 

maybe I'm wrong but if not, it was nice to include this information an some examples on the  manual
so that anyone could make it more easily.

Best regards
João Marques

--- End Message ---
--- Begin Message --- Subject: Re: bug#15407: bug report Date: Wed, 18 Sep 2013 10:25:36 -0600 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8
tag 15407 notabug
thanks

On 09/18/2013 07:07 AM, João Marques wrote:
> Hi good afternoon
> 
> Yesterday i was reading the manual (man date) of the date command and I
> think that the option + and ' isn't refer on it
> 
> so i was trying to make this command on a script:
> 
>  $(date +'%Y-%m-%d '%H:%M:%S')

As written, that's not a valid command, because it has unbalanced
quotes.  ' is not an option character seen by date, but a quoting
metacharacter consumed by the shell.  You may want to read a good manual
on shell quoting; but as a short tutorial, all of the following are
equivalent:

date +%y-%m-%d\ %H:%M:%S
date '+%y-%m-%d %H:%M:%S'
date '+'"%y-%m-%d"' '"%H:%M:%S"

and so on.  To see what the shell actually did with your quote
characters, use echo (and since the output of all three of these
commands is identical, you can understand why I claim that ' is not a
format character recognized by date):

echo date +%y-%m-%d\ %H:%M:%S
echo date '+%y-%m-%d %H:%M:%S'
echo date '+'"%y-%m-%d"' '"%H:%M:%S"

Why some people insist on using '' around most of the FORMAT argument,
but not the leading + portion (that is, why you see +'%y...' instead of
'+%y...' in examples), is beyond me, but it is perfectly valid shell
quoting either way.

> 
> maybe I'm wrong but if not, it was nice to include this information an some
> examples on the  manual
> so that anyone could make it more easily.

Meanwhile, the '+' option IS documented, in both the man and info pages.
 The man page starts out with:

SYNOPSIS
       date [OPTION]... [+FORMAT]
       date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]

See, right there, the leading '+' is what designates a FORMAT argument.
 Failing to use a leading '+' is what tells date to interpret its
argument as MMDDhhmm instead of FORMAT.

Therefore, I'm closing this as not a bug, although you should feel free
to reply with any further questions.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]