Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How can I execute a command making it believe that is on a different date than system one?

For instance, if I have this script:

#!/usr/bin/env bash    
date +"%B %d, %Y"

It prints the actual date: march 13, 2014

But I would like it to print a different date, on the future or past, without changing the system date.

If I wasn't clear enough, I want a command line tool like this Windows GUI tool.


I do not want to use a different script (it was just an example).
I do not want to set a cronjob.
I do not want to change my general system date.
Only change the date that apply to the command to run.

share|improve this question
1  
I deleted a duplicate answer that you accepted; you might want to accept the original instead –  Michael Mrozek Mar 17 at 14:31
add comment

1 Answer

up vote 11 down vote accepted

Using the faketime software could be a solution

sudo apt-get install faketime
faketime '2006-09-20' wine Example.exe

Cheers

share|improve this answer
    
that sounds promising, thank you! haven't found that one. I'll give it a try! –  Udo Gröbner Jul 11 '13 at 20:27
    
it did the trick on wine? i tested just on native binaries; cheers –  nwildner Jul 12 '13 at 13:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.