bash question

Anderson Lizardo lizardo at linuxfromscratch.org
Sat Feb 5 16:15:36 PST 2005


On Saturday 05 February 2005 18:21, ken_i_m at elegantinnovations.net wrote:
> Hi,
>
> I want to branch a process that sleeps, then does something when it
> wakes up.
> [...]
> If I run 'sleeper' directly it works as expected.  If it's started by the
> main bash script it does the stuff before the sleep, sleeps, then
> nothing.

Well, here it works:

lizardo:/tmp$ cat test.sh
#!/bin/bash

echo "line 1"
./sleeper.sh &
echo "line 2

lizardo:/tmp$ cat sleeper.sh
#!/bin/bash

echo "(child) line 1"
sleep 10
echo "(child) line 2"

lizardo:/tmp$ ./test.sh
line 1
(child) line 1
line 2
lizardo:/tmp$ (child) line 2

The "(child) line 2" text delivers 10 seconds after "(child) line 1", as 
expected. Maybe you just didn't wait enough? ;-)

-- 
Anderson Lizardo
lizardo at linuxfromscratch.org
http://www.linuxfromscratch.org/




More information about the lfs-chat mailing list