Problem running hush shell script from within a script

Denys Vlasenko vda.linux at googlemail.com
Fri Aug 6 17:23:36 UTC 2010


On Fri, Aug 6, 2010 at 7:11 PM, Adam Rosenberg <adam at alcorn.com> wrote:
> Denys,
>
> Thank you for this information.  I am modifying the way I am writing
> the scripts to work around this problem.  Here are more details on
> exactly what is happening:
>
> 1.  I run a script called traxxOS.sh
> 2.  traxxOS.sh runs a script called traxxIO.sh and passes 1 parameter
> "start" to it

How does it run it?

/path/to/traxxIO.sh start
or
. /path/to/traxxIO.sh start
or
hush /path/to/traxxIO.sh start
or
hush -c '/path/to/traxxIO.sh start'
or
??????

> 3.  traxxIO.sh loads a kernel module that is a custom made character
> device I use for interfacing with various inputs and leds on my custom
> Blackfin BF537 based board

More details please:

3a.  ...and traxxIO.sh terminates, allowing traxxOS.sh to continue (right?)

> 4.  traxxOS.sh runs traxxIO.sh and passes 1 parameter
> "start_cf_autodetect" to it

Again, how is it started?

> 5.  traxxIO.sh uses the echo command to write a string to the
> previously created character device at /dev/traxx_io
>
> At step 5 is where I run into the problem.  the system behaves as
> though the device is not there.  I get no indication from the kernel
> module that it received the string sent by the echo command.  If I run
> traxxIO.sh and pass the same "start_cf_autodetect" parameter from the
> command line (instead of from within the traxxOS.sh script) it works
> perfectly.

Do you give kernel time to perform hotplug (which isn't instantaneous)?
In other words, for quick check, add

sleep 2
ls -l /dev

before step 4. If it started to work, then the problem is found,
and now it's a matter of waiting for the /dev node to appear
(some sort of "while ! test -e /dev/foo; do usleep 50; done" loop)

> I am sorry I do not have time to track down what is causing this, but
> my workaround is to use the "." command to load a configuration script
> into the traxxOS.sh script so that I can do everything from within the
> one traxxOS.sh script.

More details please?

/path/to/traxxIO.sh start does not work
but
. /path/to/traxxIO.sh start works?

-- 
vda


More information about the busybox mailing list