public inbox for linux-newbie@vger.kernel.org
 help / color / mirror / Atom feed
* Running script on 2.6 fails
@ 2005-08-03 13:15 jampala-baba
  2005-08-03 19:00 ` Arturas Moskvinas
  0 siblings, 1 reply; 6+ messages in thread
From: jampala-baba @ 2005-08-03 13:15 UTC (permalink / raw)
  To: linux-newbie; +Cc: mukundjb

Dear all,

I am right now working on understaning the 2.6 kernel BLOCK sbull
drivers implementation provided in the Linux book 3rd Edition book.

I am OK with the block driver aspects. But, I am NOT able to run
sbull_load scruipt to create the device NODES.
when I tried running the script, i failed saying

# sh sbull_load
: command not found
' bull_load: line 4: syntax error near unexpected token '{
' bull_load: line 4: '{

Can some one give an idea why is this failing?
Some one please help me in this aspect.

Regards,
Mukund Jampala
-
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Running script on 2.6 fails
@ 2005-08-03 15:43 Mukund JB.
  0 siblings, 0 replies; 6+ messages in thread
From: Mukund JB. @ 2005-08-03 15:43 UTC (permalink / raw)
  To: linux-newbie

Dear all,

I am right now working on understanding the 2.6 kernel BLOCK sbull
driver implementation provided in the Linux book 3rd Edition book.

I am OK with the block driver aspects. But, I am NOT able to run
sbull_load script to create the device NODES. When I tried running the
script, I failed saying

# sh sbull_load
: command not found
' bull_load: line 4: syntax error near unexpected token '{
' bull_load: line 4: '{

Can some one give an idea why is this failing?
Someone please help me in this aspect.You can see the 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

}

# FIXME: This isn't handling minors (partitions) at all.

module="sbull"

device="sbull"

mode="664"

chardevice="sbullr"

minors=16

 

# Group: since distributions do it differently, look for wheel or use
staff

if grep '^staff:' /etc/group > /dev/null; then

    group="staff"

else

    group="wheel"

fi

 

# invoke insmod with all arguments we got

# and use a pathname, as newer modutils don't look in . by default

/sbin/insmod -f ./$module.ko $* || exit 1

major=`cat /proc/devices | awk "\\$2==\"$module\" {print \\$1}"`

# Remove stale nodes and replace them, then give gid and perms

rm -f /dev/${device}[a-d]* /dev/${device}

mknod /dev/${device}a b $major 0

make_minors /dev/${device}a 0

mknod /dev/${device}b b $major 16

make_minors /dev/${device}b 16

mknod /dev/${device}c b $major 32

make_minors /dev/${device}c 32

mknod /dev/${device}d b $major 48

make_minors /dev/${device}d 48

ln -sf ${device}a /dev/${device}

chgrp $group /dev/${device}[a-d]*

chmod $mode  /dev/${device}[a-d]*

------------------------- sbull_load script ENDS
--------------------------
 

 

 


-
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Running script on 2.6 fails
  2005-08-03 13:15 Running script on 2.6 fails jampala-baba
@ 2005-08-03 19:00 ` Arturas Moskvinas
  0 siblings, 0 replies; 6+ messages in thread
From: Arturas Moskvinas @ 2005-08-03 19:00 UTC (permalink / raw)
  To: jampala-baba; +Cc: linux-newbie, mukundjb

> Dear all,
> 
> I am right now working on understaning the 2.6 kernel BLOCK sbull
> drivers implementation provided in the Linux book 3rd Edition book.
> 
> I am OK with the block driver aspects. But, I am NOT able to run
> sbull_load scruipt to create the device NODES.
> when I tried running the script, i failed saying
> 
> # sh sbull_load
> : command not found
> ' bull_load: line 4: syntax error near unexpected token '{
> ' bull_load: line 4: '{

Send part of the "script" so, we could analyse it...

Arturas M.
-
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Running script on 2.6 fails
@ 2005-08-04  4:43 Mukund JB.
  2005-08-04 11:00 ` Andrzej Doyle
  0 siblings, 1 reply; 6+ messages in thread
From: Mukund JB. @ 2005-08-04  4:43 UTC (permalink / raw)
  To: Arturas Moskvinas, jampala-baba; +Cc: linux-newbie


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

}

# FIXME: This isn't handling minors (partitions) at all.

module="sbull"

device="sbull"

mode="664"

chardevice="sbullr"

minors=16

# Group: since distributions do it differently, look for wheel or use
staff

if grep '^staff:' /etc/group > /dev/null; then
    group="staff"
else
    group="wheel"

fi
 

# invoke insmod with all arguments we got

# and use a pathname, as newer modutils don't look in . by default

/sbin/insmod -f ./$module.ko $* || exit 1

major=`cat /proc/devices | awk "\\$2==\"$module\" {print \\$1}"`

# Remove stale nodes and replace them, then give gid and perms

rm -f /dev/${device}[a-d]* /dev/${device}

mknod /dev/${device}a b $major 0

make_minors /dev/${device}a 0

mknod /dev/${device}b b $major 16

make_minors /dev/${device}b 16

mknod /dev/${device}c b $major 32

make_minors /dev/${device}c 32

mknod /dev/${device}d b $major 48

make_minors /dev/${device}d 48

ln -sf ${device}a /dev/${device}

chgrp $group /dev/${device}[a-d]*

chmod $mode  /dev/${device}[a-d]*

------------------------- sbull_load script ENDS
--------------------------

-----




>> Dear all,
>>
>> I am right now working on understaning the 2.6 kernel BLOCK sbull
>> drivers implementation provided in the Linux book 3rd Edition book.
>>
>> I am OK with the block driver aspects. But, I am NOT able to run
>> sbull_load scruipt to create the device NODES.
>> when I tried running the script, i failed saying
>>
>> # sh sbull_load
>> : command not found
>> ' bull_load: line 4: syntax error near unexpected token '{
>> ' bull_load: line 4: '{
>
>Send part of the "script" so, we could analyse it...
>
>Arturas M.
-
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Running script on 2.6 fails
  2005-08-04  4:43 Mukund JB.
@ 2005-08-04 11:00 ` Andrzej Doyle
  0 siblings, 0 replies; 6+ messages in thread
From: Andrzej Doyle @ 2005-08-04 11:00 UTC (permalink / raw)
  To: Mukund JB.; +Cc: linux-newbie

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Running script on 2.6 fails
@ 2005-08-04 12:09 Mukund JB.
  0 siblings, 0 replies; 6+ messages in thread
From: Mukund JB. @ 2005-08-04 12:09 UTC (permalink / raw)
  To: Andrzej Doyle; +Cc: linux-newbie

Dear,
It looks like a problem with opening on windows and later using it it
linux.
That worked after I wrote it manually the script

Mukund Jampala

>-----Original Message-----
>From: Andrzej Doyle [mailto:dtsazza@gmail.com]
>Sent: Thursday, August 04, 2005 4:31 PM
>To: Mukund JB.
>Cc: linux-newbie@vger.kernel.org
>Subject: Re: Running script on 2.6 fails
>
>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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-08-04 12:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-03 13:15 Running script on 2.6 fails jampala-baba
2005-08-03 19:00 ` Arturas Moskvinas
  -- strict thread matches above, loose matches on Subject: below --
2005-08-03 15:43 Mukund JB.
2005-08-04  4:43 Mukund JB.
2005-08-04 11:00 ` Andrzej Doyle
2005-08-04 12:09 Mukund JB.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox