From: Andrzej Doyle <dtsazza@gmail.com>
To: "Mukund JB." <mukundjb@esntechnologies.co.in>
Cc: linux-newbie@vger.kernel.org
Subject: Re: Running script on 2.6 fails
Date: Thu, 04 Aug 2005 12:00:38 +0100 [thread overview]
Message-ID: <42F1F556.6040404@andrzejdoyle.co.uk> (raw)
In-Reply-To: <C349E772C72290419567CFD84C26E0170423C7@mail.esn.co.in>
Mukund JB. wrote:
>>>[Error is:]
>>># sh sbull_load
>>>: command not found
>>>' bull_load: line 4: syntax error near unexpected token '{
>>>' bull_load: line 4: '{
>
>Dear Arturas,
>
>Please see the entire sbull_load script below
>
>Regards,
>Mukund Jampala
>
>-------------------------- sbull_load script
>-------------------------------
>
>#!/bin/sh
>
>function make_minors {
>
> let part=1
>
> while (($part < $minors)); do
>
> let minor=$part+$2
>
> mknod $1$part b $major $minor
>
> let part=$part+1
>
> done
>
>}
>
>...
>
>------------------------- sbull_load script ENDS
>--------------------------
>
>
Line 4 of your script is the while(...) do line. Although I'm by no
means an expert in shell scripting, I can see that you're referencing
the variable $minors before either declaring it or initialising it.
Though this might not actually throw an error, it's bad programming
practice, since as well as the possibility of the 'default' value
changing, it also makes your program harder to read. I see you set the
variable in the loop, so you could either change it into a do ... while
loop (if you know you'll be going through it at least once), or just add
another "let minor=$part+$2" line just after the "let part=1" line.
That said, I don't see a single '{' in that area of code that the shell
could be complaining about. Since it's mentioning bull_load, and you've
give us sbull_load (note extra s), are you sure you're running the
script you intended, and not (perhaps) an older version of it? If not,
and bull_load is a short little thing that calls sbull_load to do the
actual work, I'd still need to see bull_load since that's where the
error lies.
Andrzej
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
next prev parent reply other threads:[~2005-08-04 11:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-04 4:43 Running script on 2.6 fails Mukund JB.
2005-08-04 11:00 ` Andrzej Doyle [this message]
-- strict thread matches above, loose matches on Subject: below --
2005-08-04 12:09 Mukund JB.
2005-08-03 15:43 Mukund JB.
2005-08-03 13:15 jampala-baba
2005-08-03 19:00 ` Arturas Moskvinas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=42F1F556.6040404@andrzejdoyle.co.uk \
--to=dtsazza@gmail.com \
--cc=linux-newbie@vger.kernel.org \
--cc=mukundjb@esntechnologies.co.in \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox