Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 11-10-2010, 01:09 PM   #1
LQ Newbie
Registered: Aug 2003
Posts: 8

Rep: Reputation: 0
csh - break: Not in while/foreach

I've just imaged 6 machines with Centos 5.5 - 2.6.18-194.17.4.el5 SMP x86_64. Everything seems to work except when I try to run csh or tsch I get the message:

# csh
break: Not in while/foreach.

The only place I find this is in tcsh/tests/ in the source code for tcsh. Anyone have any idea why this might be happening or how I might diagnose this.

Other machines with the same version of tcsh (tcsh.x86_64 0:6.14-17.el5_5.2) are working just fine. I've tried earlier versions but this has the same result
Old 11-10-2010, 05:57 PM   #2
Senior Member
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,126
Blog Entries: 2

Rep: Reputation: 124Reputation: 124
look in your .cshrc .tcshrc files and see if you have a bogus break in a foreach, potentially if it's loading .profile (not sure if csh does that) you might be pulling in a bash init file like .bashrc
Old 11-11-2010, 11:27 AM   #3
LQ Newbie
Registered: Aug 2003
Posts: 8

Original Poster
Rep: Reputation: 0

Thanks for the input, it pointed me in the right direction. The problem was with the openwin.csh script in /etc/profile.d. (file was dated 2004!)
I must have selected openwin when installing the original machine just in case someone ever wanted it. I'm not overly familiar with csh so I can't quite tell what is wrong here, maybe someone else can see?

File contents:
# OpenWindows initialization script (csh)
if ( $?OPENWINHOME ) then
         if ( $OPENWINHOME == "/usr/openwin" ) then
setenv OPENWINHOME /usr/openwin
setenv GUIDEHOME ${OPENWINHOME}/lib/guide
setenv HELPPATH ${OPENWINHOME}/lib/help
set owpath="${OPENWINHOME}/bin"
echo ${PATH} | grep -q ${owpath}
if ( $status == 0 ) then
setenv PATH "${owpath}:${PATH}"
Old 11-11-2010, 12:00 PM   #4
Registered: Aug 2006
Location: Saint Paul, MN, USA
Distribution: {Free,Open}BSD, CentOS, Debian, Fedora, Solaris, SuSE
Posts: 732

Rep: Reputation: 75
       break   Causes execution to resume after the end of the nearest enclos-
               ing  foreach  or  while.  The remaining commands on the current
               line are executed.  Multi-level breaks  are  thus  possible  by
               writing them all on one line.

excerpt form man tcsh
For a system running:
Environment: LC_ALL = C, LANG = en_US.UTF-8
(Versions displayed with local utility "version")
OS, ker|rel, machine: Linux, 2.6.18-194.11.4.el5, i686
Distribution        : CentOS release 5.5 (Final)
tcsh 6.14.00
This system has no record of openwin in /etc/profile.d nor anyplace else, searching with locate openwin, but found:
$ locate tcsh
( and many other hits)
With the repositories I have (default, to the best of my knowledge), yum finds nothing about openwin:
$ yum info '*openwin*'
Loaded plugins: priorities
addons                                                   |  951 B     00:00     
base                                                     | 2.1 kB     00:00     
extras                                                   | 2.1 kB     00:00     
updates                                                  | 1.9 kB     00:00     
Error: No matching Packages to list
My recollection about openwin is that it is associated with Solaris, not CentOS, but I haven't done any searching to verify that.

Regarding the error, perhaps tcsh is more particular about where break can be placed, namely, only in a while or foreach loop -- I could believe that csh might simply ignore it. If I find a real csh (say on Solaris) I'll try to remember to test that.

Best wishes ... cheers, makyo
Old 11-11-2010, 01:00 PM   #5
LQ Newbie
Registered: Aug 2003
Posts: 8

Original Poster
Rep: Reputation: 0
Strange, openwin was indeed the windows manager for Solaris 10 for sure. The other possible culprit for inserting this file is the proprietary nvidia drivers. The first machine had :-


These seem to be no longer be maintained. So the other machines cloned from the first have:-


I'm just glad csh works now


csh, tcsh

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
exit by foreach cicle shifter Programming 1 06-21-2010 03:13 PM
how to use foreach in bash shell minsi Linux - Newbie 9 03-26-2010 02:34 AM
How to use foreach on filenames with spaces? BrianK Linux - General 3 08-09-2005 01:15 PM
foreach loops chunky Linux - General 2 07-02-2004 12:49 PM
perl:foreach katana Programming 3 07-24-2001 02:05 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:44 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration