[Top][All Lists]

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

Re: One posibly "improvement" for date.c...

From: Eric Blake
Subject: Re: One posibly "improvement" for date.c...
Date: Tue, 18 Apr 2006 13:47:17 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Ville solarius <ville.solarius <at> gmail.com> writes:

> Hi all!
> Yesterday, i wrote very small patch for date-program(date.c), i peronaly 
> feature to strip out newline-sign at end of output. I hope it is
> useful for whole project too, so it is free to use in date.

>From any POSIX-compliant shell, this does what you are asking for,
since command substitution strips trailing newlines:
printf %s "$(date)"

> In fact, this is my first patch,so i just diff my date.c and cvs's
> date.c, and i hope i did it right;) It is at end of this message, i
> hope it works(like i sad, i havent do patches before;) Remember backup
> your original date.c in case that i've done something wrong!)

Thanks for the patch.  However, on this list, we prefer unified patches
(diff -up), because context is essential for ensuring a patch applies
cleanly.  Furthermore, as has been pointed out, the functionality
you desire is already part of the shell, so it does not make sense
to bloat date with this functionality.

> PS. I personally needed it because i needed time stamp to my bash shellprompt

Since you are using bash, read 'man bash' under the PROMPTING section
- perhaps the \D{format} escape sequence in PS1 is a better solution to
your needs.

Eric Blake

reply via email to

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