bash Scripts

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Dale Farnsworth
Date:  
Subject: bash Scripts
On Fri, May 24, 2002 at 03:45:01AM +0000, Clayton Stapleton wrote:
> My system is an Athlon 1600X CPU, 256MB of memory, with SuSE Linux 7.3
> mounted as a dual boot. The version of bash is 2.05-82. When I try some
> of the exercises in the Bash-Prog-Intro-HOWTO-1.html such as the "for",
> "while" and "until" loops thats as far as I have gotten so far I get the
> following from this "for" script when it is run:
>
> #!/bin/bash
> for i in `seq 1 10`;
> do
>         echo $i
> done

>
> bash: syntax error near unexpected token `for'


The problem is a simple one. Your scripts are never being executed.
The following commands are built-in to bash: for, while, until.
Bash is running the builtin rather than your script.

Either rename your "for" script to something else such as "myfor"
or invoke it differently, like "./for" or "'for'".

-Dale