The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Simulators >> Circuit Simulators >> foreach command cshell scripting
https://designers-guide.org/forum/YaBB.pl?num=1266475402

Message started by avlsi on Feb 17th, 2010, 10:43pm

Title: foreach command cshell scripting
Post by avlsi on Feb 17th, 2010, 10:43pm

Hi everyone,

                  In my cshell script, there are few foreach loops in which few commands gets executed. It is written as

foreach vds ( 1.1 1.2)
foreach temp ( 27.0 126.0)
commands
...
end
end

But when i execute the script by sourcing it..There are errors saying
foreach: Words not parentisized

Please help me to solve the error.

Thanks in advance.

Title: Re: foreach command cshell scripting
Post by Ken Kundert on Feb 17th, 2010, 11:51pm

What you typed looks okay to me. Use

Code:
set echo
before the for loops to see on which statement the error occurs.

-Ken

Title: Re: foreach command cshell scripting
Post by avlsi on Feb 18th, 2010, 12:12am

Hi Ken,

          when i put echo in front of foreach loops.The error is Badly Placed ()'s.

          One more issue in my cshell script is, i have commands like mkdir file1. But the created directory name is file1? . I dont understand why the file is created in this way.

Thanks for ur prompt reply.

Title: Re: foreach command cshell scripting
Post by boe on Feb 18th, 2010, 5:07am

avlsi,
You probably have an invisible control character at the end of your line, e.g. CR (^M, 0x0D).
BOE

Title: Re: foreach command cshell scripting
Post by Ken Kundert on Feb 18th, 2010, 12:49pm

I was suggesting that you use echo to identify the offending line.

Avlsi might be on to something. Perhaps you are using a file formatted for windows or mac on unix, or visaversa. Try opening the file in vi, then type
:set ff=unix
:wq
and try again.

Is there some reason why you don't just post the script? It would be much easier to help you if we did not have to guess what you were doing.

-Ken

The Designer's Guide Community Forum » Powered by YaBB 2.2.2!
YaBB © 2000-2008. All Rights Reserved.