[X-Unix] BASH problem?

Larry Helms lhelms at sonic.net
Sun Dec 12 08:53:34 PST 2004


Been coding long?  Or just reading about it... JUST KIDDING!

Seriously though, you've made a very simple syntactic error.
You need to remove the SPACE between 'Myday' and `date

I cut-n-pasted this little tidbit onto my system...
Made that change, chmod'd the file... And was able to execute
it is no problems.
______________________________________________________________________
    Cosmo :: /Users/lhelms
    lhelms > vi bob

    #!/bin/tcsh -x

    set Myday=`date '+%a'`
    echo $Myday `date` | tee -a tempfile
    setenv CVSROOT :pserver:anonymous at cvs-mirror.mozilla.org:/cvsroot

    env | grep -i shell
    ~
    ~
    ~
    "bob" 7L, 161C written

__________ Change security so you can execute the script.

    Cosmo :: /Users/lhelms
    lhelms > chmod 755 bob

__________ Shows that I'm executing under the

    Cosmo :: /Users/lhelms
    lhelms > env|grep -i shell
    SHELL=/bin/zsh

__________ Now, execute bob.

    Cosmo :: /Users/lhelms
    lhelms > ./bob

    Executing /Users/lhelms/.cshrc

    set Myday=`date '+%a'`
    date +%a
    tee -a tempfile
    echo Sun `date`
    date
    Sun Sun Dec 12 08:41:09 PST 2004
    setenv CVSROOT :pserver:anonymous at cvs-mirror.mozilla.org:/cvsroot

__________ Display contents of tempfile

    Cosmo :: /Users/lhelms
    lhelms > cat tempfile
    Sun Sun Dec 12 08:41:09 PST 2004



More information about the X-Unix mailing list