Mike Harris | 2 Jan 2007 05:57
Favicon

Problems Aliasing Remind Output Using the Today Variable

I have a few commands aliased in Unix (I'm using Mac OS X) so that they will show me tomorrow's schedule, the
day after that, and so on.  As I use tcsh, the alias takes the form of:

alias 2trem "remind ~/.reminders `(echo 'banner %'; echo 'msg [trigger(today()+2)]') | remind -`"
alias 2yrem "remind ~/.reminders `(echo 'banner %'; echo 'msg [trigger(today()-2)]') | remind -`"
alias 3trem "remind ~/.reminders `(echo 'banner %'; echo 'msg [trigger(today()+3)]') | remind -`"
alias 3yrem "remind ~/.reminders `(echo 'banner %'; echo 'msg [trigger(today()-3)]') | remind -`"
alias trem "remind ~/.reminders `(echo 'banner %'; echo 'msg [trigger(today()+1)]') | remind -`"
alias yrem "remind ~/.reminders `(echo 'banner %'; echo 'msg [trigger(today()-1)]') | remind -`"

The problem I am running into with this setup, however, is that the 'today()' variable doesn't seem to get
refreshed at all from day to day.  In other words, let's say I open up a terminal session on December 29.

If I ran trem today -- the evening of January 1, 2007 -- it would not show me remind's output for 1/2/07, it
would show remind's output to me for 12/30/06.

Any thoughts on how to solve this?

Mike

Justin Alcorn | 2 Jan 2007 17:10
Favicon

Re: Problems Aliasing Remind Output Using the Today Variable

The problem is that the alias commands are run as part of your shell 
startup, and the command

`(echo 'banner %'; echo 'msg [trigger(today()+2)]') | remind -`

is run during shell startup, and the _result_ is used in the alias 
command.  So the date is the day you log in.

You need to find some way to escape the meaning of the `` and have that 
put into the alias.

The easiest way is to forget alias and make them shell scripts in your path.

Mike Harris wrote:
> I have a few commands aliased in Unix (I'm using Mac OS X) so that they will show me tomorrow's schedule, the
day after that, and so on.  As I use tcsh, the alias takes the form of:
> 
> alias 2trem "remind ~/.reminders `(echo 'banner %'; echo 'msg [trigger(today()+2)]') | remind -`"
> alias 2yrem "remind ~/.reminders `(echo 'banner %'; echo 'msg [trigger(today()-2)]') | remind -`"
> alias 3trem "remind ~/.reminders `(echo 'banner %'; echo 'msg [trigger(today()+3)]') | remind -`"
> alias 3yrem "remind ~/.reminders `(echo 'banner %'; echo 'msg [trigger(today()-3)]') | remind -`"
> alias trem "remind ~/.reminders `(echo 'banner %'; echo 'msg [trigger(today()+1)]') | remind -`"
> alias yrem "remind ~/.reminders `(echo 'banner %'; echo 'msg [trigger(today()-1)]') | remind -`"
> 
> The problem I am running into with this setup, however, is that the 'today()' variable doesn't seem to get
refreshed at all from day to day.  In other words, let's say I open up a terminal session on December 29.
> 
> If I ran trem today -- the evening of January 1, 2007 -- it would not show me remind's output for 1/2/07, it
would show remind's output to me for 12/30/06.
> 
(Continue reading)

Mike Harris | 3 Jan 2007 02:39
Favicon

Re: Problems Aliasing Remind Output Using the Today Variable

(1/2/07 10:10 AM) Justin Alcorn <justin@...> wrote:

> The easiest way is to forget alias and make them shell
> scripts in your path.

Thanks, Justin.  I've set them up as shell scripts, and hopefully that'll do the trick.  Much obliged!

Mike

Martin Stubenschrott | 4 Jan 2007 22:32
Picon

-g not honored when using -n

Hi,

I want to show reminders sorted by date with `rem', however the output
is not sorted when using the -g flag combined with -n:

See this usage example, which should work even without my .reminders
file:
------------------------------------------------------------
# rem                                                                                        ~
Reminders for Thursday, 4th January, 2007 (today):

karambolage - arte

polylux - ard

quer - br

monk

# rem -g                                                                                     ~
Reminders for Thursday, 4th January, 2007 (today):

quer - br

monk

polylux - ard

karambolage - arte

(Continue reading)

Paul Pelzl | 5 Jan 2007 00:51
Picon
Favicon

Re: -g not honored when using -n

On Thu, Jan 04, 2007 at 10:32:20PM +0100, Martin Stubenschrott wrote:
> I want to show reminders sorted by date with `rem', however the output
> is not sorted when using the -g flag combined with -n:

As a workaround, "rem -n -b1 | sort" should give you roughly what you're
looking for (Wyrd does something like this for the next_reminder
operation).  Of course, I agree that it would be nice if "-g" did
something useful in this context.

Paul

T E Schmitz | 5 Jan 2007 01:05
Picon

trigger date defined as: date+x days

I am sorry if this is a daft question but I can't get my head around this:

My event is, say, 180 days after a certain date. So, I want date+180 as 
my trigger date. How do I express this?

--

-- 

Kind Regards,

Tarlika Elisabeth Schmitz

Paul Pelzl | 5 Jan 2007 01:27
Picon
Favicon

Re: trigger date defined as: date+x days

On Fri, Jan 05, 2007 at 12:05:59AM +0000, T E Schmitz wrote:
> I am sorry if this is a daft question but I can't get my head around this:
> 
> My event is, say, 180 days after a certain date. So, I want date+180 as 
> my trigger date. How do I express this?

If you know the value of "date" ahead of time, then you can enter it as
a date constant which can be used in arithmetic expressions:

   REM [trigger('2007-01-04' + 180)] MSG 180 days after Jan 4

If you need to do more complicated scripting, then you might want to
work some magic with trigdate():

   REM Jan 4 2007 SATISFY 1        # (or maybe something more complex)
   REM [trigger(trigdate() + 180)] MSG 180 days after previous trigger

Paul

T E Schmitz | 5 Jan 2007 11:41
Picon

Re: trigger date defined as: date+x days

Paul Pelzl wrote:
> On Fri, Jan 05, 2007 at 12:05:59AM +0000, T E Schmitz wrote:
> 
>>My event is, say, 180 days after a certain date. So, I want date+180 as 
>>my trigger date. How do I express this?
> 
> 
> If you know the value of "date" ahead of time, then you can enter it as
> a date constant which can be used in arithmetic expressions:
> 
>    REM [trigger('2007-01-04' + 180)] MSG 180 days after Jan 4

That's just what I was after!
Thank you for taking the time to reply!
--

-- 

Regards,

Tarlika Elisabeth

T E Schmitz | 5 Jan 2007 13:08
Picon

Re: trigger date defined as: date+x days

Paul Pelzl wrote:
> On Fri, Jan 05, 2007 at 12:05:59AM +0000, T E Schmitz wrote:
>>My event is, say, 180 days after a certain date. So, I want date+180 as 
>>my trigger date. How do I express this?
> 
> 
> If you know the value of "date" ahead of time, then you can enter it as
> a date constant which can be used in arithmetic expressions:
> 
>    REM [trigger('2007-01-04' + 180)] MSG 180 days after Jan 4

How would I add 3 months?

--

-- 

Regards,

Tarlika Elisabeth

Paul Pelzl | 5 Jan 2007 16:17
Picon
Favicon

Re: trigger date defined as: date+x days

On Fri, Jan 05, 2007 at 12:08:34PM +0000, T E Schmitz wrote:
> Paul Pelzl wrote:
> > On Fri, Jan 05, 2007 at 12:05:59AM +0000, T E Schmitz wrote:
> >>My event is, say, 180 days after a certain date. So, I want date+180 as 
> >>my trigger date. How do I express this?
> > 
> > 
> > If you know the value of "date" ahead of time, then you can enter it as
> > a date constant which can be used in arithmetic expressions:
> > 
> >    REM [trigger('2007-01-04' + 180)] MSG 180 days after Jan 4
> 
> How would I add 3 months?

   FSET _add_months(d_date, m_int) date(year(d_date), monnum(d_date) + m_int, day(d_date))
   REM [trigger(_add_months('2007-01-04', 3))] MSG three months after Jan 4

This is untested, but probably works.  

I feel like I should point out that these are not very common Remind
idioms.  Usually it's possible to get the reminder you're looking for
without doing so much work, and I'm starting to wonder if you trying to
solve a problem the hard way...

Paul


Gmane