Advanced

Linux/UNIX Easy date manipulation with yest

Posted by nixcraft on · 10 comments
nixcraft; By nixcraft
Mail this story
Print this story

Sometime it is necessary to run a command or script on the last day of a month. There is old good hack that will decide whether tomorrow is the first day of the next month. All these years I was using *dirty shell script hacks* to create my own date manipulation utilities for backups and other admin task. Thanks to this project no more dirty work. yest is highly recommended tool for all seasoned UNIX admin.

Full Story

  Nav
» Read more about: Story Type: Tutorial; Groups: Debian, Fedora, Gentoo, GNU, Linux

» Get new stories by e-mail: nightly or as they are published

« Return to the newswire homepage

  Related stories
» More like this

Comments (10)

It's main claim to fame seems to be that it can, in one line, determine if today is the last day of the month.

I think this is just as easy:

[ $(date -d "tomorrow" "+%d") -eq 1 ]

Does every date command support that? I just tried it on an AIX 5.2 machine to no avail
> I just tried it on an AIX 5.2 machine to no avail

Show off. :)
AIX is also known as Vale of Pain. Showoff, indeed!
It's not working on my Commodore 128 either.
> It's not working on my Commodore 128 either.

Hmm, I wonder if it would work on OS-9? Well, I doubt I really want to pull my CoCo 3 out to find out, so I guess I'll never know.
I must commend you all on your efforts to recycle old technology. I'm sure mother nature is pleased :D
Hey ... AIX 5.2 ain't old, just painful.
I can't even find the date command on my abacus.
I'm with you TC :)

Post a comment

A free account is needed to post. Write your comment here first: your text is kept in this browser while you sign up or log in, and is waiting for you when you come back.

Your message:
|||||
10
Markdown: **bold**, *italic*, [text](https://link), - lists, > quotes, $x^2$ for math. Formatting help

Sign up and post (it is free)  or  Log in and post