This is the mail archive of the
mailing list for the Cygwin project.
Re: writing csh scripts with cygwin
- From: Brian Ford <ford at vss dot fsi dot com>
- To: Christopher Spears <cspears2002 at yahoo dot com>
- Cc: cygwin at cygwin dot com
- Date: Thu, 8 Apr 2004 14:16:29 -0500 (CDT)
- Subject: Re: writing csh scripts with cygwin
- References: <firstname.lastname@example.org>
- Reply-to: cygwin at cygwin dot com
On Thu, 8 Apr 2004, Christopher Spears wrote:
> I've been writing some csh scripts with cygwin and
> encountering a lot of problems. I will admit that I
> am just learning, but I copied the scripts directly
> from the book! I checked out the FAQ, and I am
> wondering if the reason why the scripts are not
> working are that they are being interpreted by bash
> not tcsh. Is this possible?
Yes, although it's probably ash. How are you invoking the script?
> Here is an example. My script is:
> #csh that gives system status
How about a
here instead? Although #!tcsh may work, don't count on that being
> set d = `date`
> echo "Today's date: $d[2-3] $d"
> echo "Current time: $d"
> echo Number of users: `who | wc -l`
> echo Current disk storage: ` du -s .`
> Here is the response:
> Today's date: [2-3] 
> Current time: 
> Number of users: 0
> Current disk storage: 7 .
> Originally, the . was a ~ but that wasn't working
> because for some reason cygwin wasn't recognizing it.
Yup. You were probably using ash (otherwise known as /bin/sh on Cygwin).
> Using the FAQ for advice, I replaced ~ with $HOME
> which caused problems because my home directory is
> /home/Christopher Spears,
You need to quote like this "$HOME" to avoid that problem.
> which confuses bash,
Huh? I thought you wanted [t]csh.
> so I used .. Obviously, [2-3], , and  are not the
> answers I was looking for in my script.
> What irks my is that I did download tcsh! Was there
> something else I should have downloaded if I want to
> write csh scripts?
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html