tcsh problem

Jonathan Chen jonc at chen.org.nz
Wed Aug 11 20:34:45 PDT 2004


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 at chen.org.nz>
----------------------------------------------------------------------
             "A person should be able to do a small bit of everything,
                                        specialisation is for insects"


More information about the freebsd-questions mailing list