tech-userlevel archive

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

Re: Proposal: Add option to add dates to write(1)

On Wed, Jun 27, 2012 at 09:00:22PM +0200, Julian Fagir wrote:
> Hi,
> > I'm using write(1) on machines where people are logged in for days, weeks,
> > months, running a tmux, as well as their write-sessions.
> > It's annoying to not know the date when somebody talked to you.
> > 
> > What do you think about the attached patch (write.1 modification would
> > follow)? It just adds a flag '-t', which prepends the messages being sent
> > with a date (i.e., you and your communication partner have to agree on using
> > that flag to have it useful to yourself).
> as obviously nobody wanted this solution (and maintaining my own write is
> useless), I've done something different. Maybe it's of use for somebody...
> Compile with
>   cc -o prependate prependate.c

prependate() { s=$(date +"${1:-%X %x: }"); sed -e "s,^,$s," ; } 

> And have every message you write prepended with the date string "%X %x: ". If
> you want to have your own format string, use
>   prependate "$formatstr" | write $user
> where formatstr is anything accepted by strftime.
> Imho all in all nicer solution - it's reusable, has less than 50 lines of

^W^W^W1 line of

> code, needs no unnecessarily high permissions to run.


Home | Main Index | Thread Index | Old Index