Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Aug 2004 15:34:43 +1200
From:      Jonathan Chen <jonc@chen.org.nz>
To:        Barno <barno@amadeus.demon.nl>
Cc:        FreeBSD questions list <freebsd-questions@freebsd.org>
Subject:   Re: tcsh problem
Message-ID:  <20040812033443.GC52078@grimoire.chen.org.nz>
In-Reply-To: <A7A13568-EC05-11D8-A52A-0003939726F0@amadeus.demon.nl>
References:  <A7A13568-EC05-11D8-A52A-0003939726F0@amadeus.demon.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Aug 12, 2004 at 04:16:43AM +0200, Barno wrote:
[...]
> but when I use it in a script like this:
> #!/bin/tcsh
> set Log = ` date -v-7d "+[%d/%m/%Y:%H:%M:%S] `
> echo $Log

Tcsh treats [ and ] as variable indexers. You need to quote them out.
Here's the corrected version:

    #!/bin/tcsh
    set Log="`date -v-7d '+[%d/%m/%Y:%H:%M:%S]'`"
    echo "$Log"

-- 
Jonathan Chen <jonc@chen.org.nz>
----------------------------------------------------------------------
             "A person should be able to do a small bit of everything,
                                        specialisation is for insects"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040812033443.GC52078>