Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #270024 > unrolled thread

date for week

Started byJeff Peng <jeff@tls-mail.com>
First post2024-06-11 01:30 +0200
Last post2024-06-11 01:50 +0200
Articles 8 — 5 participants

Back to article view | Back to linux.debian.user


Contents

  date for week Jeff Peng <jeff@tls-mail.com> - 2024-06-11 01:30 +0200
    Re: date for week Roberto C. Sánchez <roberto@debian.org> - 2024-06-11 01:30 +0200
      Re: date for week Jeff Peng <jeff@tls-mail.com> - 2024-06-11 01:50 +0200
    Re: date for week Greg Wooledge <greg@wooledge.org> - 2024-06-11 01:50 +0200
      info vs. man (was: Re: date for week) Max Nikulin <manikulin@gmail.com> - 2024-06-11 18:30 +0200
        Re: info vs. man (was: Re: date for week) Greg Wooledge <greg@wooledge.org> - 2024-06-11 20:10 +0200
          Re: info vs. man Max Nikulin <manikulin@gmail.com> - 2024-06-12 18:10 +0200
    Re: date for week "rtnetzlof@windstream.net" <rtnetzlof@windstream.net> - 2024-06-11 01:50 +0200

#270024 — date for week

FromJeff Peng <jeff@tls-mail.com>
Date2024-06-11 01:30 +0200
Subjectdate for week
Message-ID<INWCB-21Cc-1@gated-at.bofh.it>
Hello,

I run the folllowing command,

$ date +%w
2


While I expect the output should be:

$ date +%such_a_option
Tuesday

or
$ date +%such_a_option
Tue

does date command has this option?

Thanks.

[toc] | [next] | [standalone]


#270025

FromRoberto C. Sánchez <roberto@debian.org>
Date2024-06-11 01:30 +0200
Message-ID<INWCB-21Cc-9@gated-at.bofh.it>
In reply to#270024
On Tue, Jun 11, 2024 at 07:19:42AM +0800, Jeff Peng wrote:
> Hello,
> 
> I run the folllowing command,
> 
> $ date +%w
> 2
> 
> 
> While I expect the output should be:
> 
> $ date +%such_a_option
> Tuesday
> 
> or
> $ date +%such_a_option
> Tue
> 
> does date command has this option?
> 
> Thanks.
> 

You probably want:

$ date +%a
Mon
$ date +%A
Monday

-- 
Roberto C. Sánchez

[toc] | [prev] | [next] | [standalone]


#270026

FromJeff Peng <jeff@tls-mail.com>
Date2024-06-11 01:50 +0200
Message-ID<INWVX-21IG-3@gated-at.bofh.it>
In reply to#270025
thanks roberto. that's exactly what i am looking for.


> $ date +%a

[toc] | [prev] | [next] | [standalone]


#270027

FromGreg Wooledge <greg@wooledge.org>
Date2024-06-11 01:50 +0200
Message-ID<INWVX-21IG-5@gated-at.bofh.it>
In reply to#270024
On Tue, Jun 11, 2024 at 07:19:42AM +0800, Jeff Peng wrote:
> While I expect the output should be:
> 
> $ date +%such_a_option
> Tuesday
> 
> or
> $ date +%such_a_option
> Tue
> 
> does date command has this option?

You can run the command "man date" to read the short version of the
documentation.  This will include the information you wanted.  Search
for "week" and it takes you right there:

       %a     locale's abbreviated weekday name (e.g., Sun)

       %A     locale's full weekday name (e.g., Sunday)

       %b     locale's abbreviated month name (e.g., Jan)

       %B     locale's full month name (e.g., January)

       %c     locale's date and time (e.g., Thu Mar  3 23:05:25 2005)

Should you ever feel a need to read the longer version of the
documentation, it's in GNU info pages.  So you would need to type
the command "info coreutils date" to get to it.  And then you'd need
to figure out the user interface of the "info" program, which is not
intuitive unless you happen to be an emacs power user already.

[toc] | [prev] | [next] | [standalone]


#270032 — info vs. man (was: Re: date for week)

FromMax Nikulin <manikulin@gmail.com>
Date2024-06-11 18:30 +0200
Subjectinfo vs. man (was: Re: date for week)
Message-ID<IOcxH-2bCu-1@gated-at.bofh.it>
In reply to#270027
On 11/06/2024 06:45, Greg Wooledge wrote:
> Should you ever feel a need to read the longer version of the
> documentation, it's in GNU info pages.  So you would need to type
> the command "info coreutils date" to get to it.  And then you'd need
> to figure out the user interface of the "info" program, which is not
> intuitive unless you happen to be an emacs power user already.

Emacs power users can type
     M-x info RET
or
     M-: (info "(coreutils) date conversion specifiers") RET
or at least
     emacs -f info-standalone '(coreutils) date conversion specifiers'

I do not mind that info browsers have usability issues. For beginners I 
would recommend tkinfo instead of terminal "info". I have not tried pinfo.

Texinfo, unlike man, has a notion of hyperlink. In the case of man it is 
just formatting that suggests that some part of text is a reference to 
another document or another section. It was created for "online" version 
of printed manuals. Info is more convenient for navigation in long 
document and makes it easier to specify a particular section. In the 
case of man it requires some tricks like

     man -P 'less -p %a' date

[toc] | [prev] | [next] | [standalone]


#270037 — Re: info vs. man (was: Re: date for week)

FromGreg Wooledge <greg@wooledge.org>
Date2024-06-11 20:10 +0200
SubjectRe: info vs. man (was: Re: date for week)
Message-ID<IOe6t-2cDo-1@gated-at.bofh.it>
In reply to#270032
On Tue, Jun 11, 2024 at 11:22:17PM +0700, Max Nikulin wrote:
> On 11/06/2024 06:45, Greg Wooledge wrote:
> > Should you ever feel a need to read the longer version of the
> > documentation, it's in GNU info pages.  So you would need to type
> > the command "info coreutils date" to get to it.  And then you'd need
> > to figure out the user interface of the "info" program, which is not
> > intuitive unless you happen to be an emacs power user already.
> 
> Emacs power users can type
>     M-x info RET
> or
>     M-: (info "(coreutils) date conversion specifiers") RET
> or at least
>     emacs -f info-standalone '(coreutils) date conversion specifiers'
> 
> I do not mind that info browsers have usability issues. For beginners I
> would recommend tkinfo instead of terminal "info". I have not tried pinfo.
> 
> Texinfo, unlike man, has a notion of hyperlink. In the case of man it is
> just formatting that suggests that some part of text is a reference to
> another document or another section.

See, this is all fine -- you've searched for the appropriate section, and
you've generated a cryptic command that someone else could type inside
emacs to get to that same section.  I'm sure there's an "info" equivalent
that can be done from a shell without invoking emacs.

None of that's useful to a person who wants to search for that information
in the first place without consulting an expert who's already done the
work.

What I was trying to do in my reply was "teach them how to fish" -- to
show them how to bring up the man page themselves, and look for basic
information like "how do I get the name of the day of the week, instead
of the numeric index of the day of the week" without having to bother
an international mailing list.

So, I gave basic instructions for how to bring up the man page, and a
hint about searching for a key word related to their question.  I even
provided a small piece of the man page, which happens to include the
answer they're looking for, because I'm also a pessimist who knows
that they probably won't look it up themselves, and may become angry
if we don't spoon-feed them the actual answer.

I also provided a reference to the info page, and a command that would
bring that up, should the need ever arise.  More importantly, I revealed
that info pages *exist* and *are a thing* that they need to know about.
It's planting a seed for the future.

[toc] | [prev] | [next] | [standalone]


#270046 — Re: info vs. man

FromMax Nikulin <manikulin@gmail.com>
Date2024-06-12 18:10 +0200
SubjectRe: info vs. man
Message-ID<IOyHT-2pT9-9@gated-at.bofh.it>
In reply to#270037
On 12/06/2024 01:00, Greg Wooledge wrote:
>> On 11/06/2024 06:45, Greg Wooledge wrote:
>>> Should you ever feel a need to read the longer version of the
>>> documentation, it's in GNU info pages.  So you would need to type
>>> the command "info coreutils date" to get to it.  And then you'd need
>>> to figure out the user interface of the "info" program, which is not
>>> intuitive unless you happen to be an emacs power user already.
[...]
> I also provided a reference to the info page, and a command that would
> bring that up, should the need ever arise.  More importantly, I revealed
> that info pages *exist* and *are a thing* that they need to know about.
> It's planting a seed for the future.

I misunderstood your intention and I am sorry for that. I found your 
words quite discouraging in respect to "info", perhaps it is just 
language barrier.

Info is quite important. While e.g. "man bash" and "info bash" documents 
are quite similar, there is no man equivalent for "info grub".

Your variant of info command is quite specific. I like that "info" 
allows partial match of node name and it may be a separate argument. 
Unfortunately tkinfo and the Emacs function require another style (info 
"(coreutils) date invocation"). Every coreutils man page has it in the 
"SEE ALSO" section.

I do not mind that users almost certainly familiar with basic pager UI 
and using of "info" requires some knowledge. In this particular case UI 
does not differ

- info "(coreutils) date invocation"
- /week [Enter]

P.S. Perhaps Emacs developers teach users how to fish as well. From my 
point of view the following path described in "emacs --help" is 
unnecessary long:

> Run M-x info RET m emacs RET m emacs invocation RET inside Emacs to
> read the main documentation for these command-line arguments.

[toc] | [prev] | [next] | [standalone]


#270028

From"rtnetzlof@windstream.net" <rtnetzlof@windstream.net>
Date2024-06-11 01:50 +0200
Message-ID<INWVX-21IG-7@gated-at.bofh.it>
In reply to#270024
All the format codes are documented in the man page for date.
in particular:

+%a gives a short form, such as Mon
+%A gives full name, e.g. Monday 
+%^a and +%^A as above, but all capital letters.

----- Original Message -----
From: "Jeff Peng" <jeff@tls-mail.com>
To: "debian-user" <debian-user@lists.debian.org>


> While I expect the output should be:

> $ date +%such_a_option
> Tuesday

> or
> $ date +%such_a_option
> Tue

> does date command has this option?

Yes, see above.

-- 
Bob Netzlof a/k/a Sweet Old Bob

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web