Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Fri, 01 Jul 2005 06:46:37 -0600 From: Mark Paulus Subject: Re: Problem with "set," "if," "foreach" commands In-reply-to: <20050701004741.63990.qmail@web52015.mail.yahoo.com> To: "cygwin AT cygwin DOT com" Message-id: <0IIY00C1I8TP2D@pmismtp01.mcilink.com> MIME-version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 7bit X-IsSubscribed: yes I would suggest you get the O'Reilly bash book, and read your way through that. What you are running into are syntax problems. On Thu, 30 Jun 2005 17:47:41 -0700 (PDT), Han Nguyen wrote: >New to Unix, so please have patience. >I understand that I should be able to type >set food = pickle >echo $food bash doesn't use set. And, when doing variable assignments in the shell, no spaces are allowed: food=pickle echo $food >But nothing echoes. It just leaves a blank line, then gives another command prompt. Am I doing >anything wrong? >"If" also doesn't work. This is what happens: >$ if (5 > 0) >> echo "Hello" >> endif >> >> >> >And it merely continues that way until I exit the shell. if doesn't use parens, it uses square brackets. And, numeric tests are not done with greater than/less than/equal symbols, but with -lt, -le, -gt, -ge, -eq tests. Spacing is important in the shell also. And, you have some other syntax issues: if [ 5 -gt 0 ] ; then echo Hello fi >Also a problem with "foreach." Output: >$ foreach run (1 2 3) >bash: syntax error near unexpected token `(' >Typing "help set" and "help foreach" gives me: >$ help foreach >bash: help: no help topics match `foreach'. Try `help help' or `man -k foreach' or `info >foreach'. In Bash, it's not foreach, but rather for var in varlist do command $var ... done >Anything I can do to resolve this? I appreciate the help. Thanks. I'm not super familiar with csh, but it almost looks to me like you are using csh commands in a bash shell. sh/ksh/bash/ash all sort of have a similar look/feel. csh is slightly different in it's approach to scripting. If you want to use the above type syntax, then maybe you could install the tcsh package, and get the O'Reilly csh/tcsh book. > >____________________________________________________ >Yahoo! Sports >Rekindle the Rivalries. Sign up for Fantasy Football >http://football.fantasysports.yahoo.com >-- >Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple >Problem reports: http://cygwin.com/problems.html >Documentation: http://cygwin.com/docs.html >FAQ: http://cygwin.com/faq/ -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/