[PLUG] bash question

Marvin J. Kosmal lamsokvr at xprt.net
Mon Aug 19 19:02:06 UTC 2002


On Monday 19 August 2002 11:39, you wrote:
>  :: On Monday 19 August 2002 10:46, you wrote:
>  :: > I'm writing a script where I want to figure out what month it
>  :: > will be X weeks from today. If it were one week from today, I
>  :: > could use date like this:
>  :: >
>  :: > date --date='+ 1 week' +%m
>  :: >
>  :: > This stores it to a variable (X):
>  :: >
>  :: > X=$(date --date='+ 1 week' +%m)
>  :: >
>  :: > But what if the 1 in the above statement is itself a
>  :: > variable?
>  :: >
>  :: > Y=1
>  :: > X=$(date --date='+ $Y week' +%m)
>  :: >
>  :: > I get this error:
>  :: >
>  :: > date: invalid date `+ $Y week'
>  :: >
>  :: > How do I proceed here?
>  ::
>  ::  Try  $(Y) week
>  ::
>  :: Marvin
>
> Marvin, did you? (Try it, I mean)?
>
> If it works I'd be mighty surpised since $(Y) will be just as
> enclosed in quotes as $Y was.  Which means it won't expand.
>
>
> <Rant on> I'd sure like to see people take the extra 5 seconds to
>           actually test their proposed solutions instead if
> misleading people down dead-ends.  Especially when the proposed
> solution is trivially easy to test.  It is extremely frustrating to
> get 17 solutions (as I did on another list with my recent xinerama
> problems) 16 of which were utterly useless, misleading, "solutions"
> from people who didn't even bother to read the problem statement
> fully.  (Thanks to the one or two who took the time to write a
> thoughtful answer.)
>
>           It is actually better to not answer a question than to
> get a a non-sense answer that a newbie will believe as correct. He
> then tries it, bombs out, and says to his friends, "This Linux OS
> is a piece of hard-to-understand junk!" <Rant off>
>
>
> Bad morning.
>
> Dean
>

I agree!!  ;-))

Marvin





More information about the PLUG mailing list