Last change
on this file was 2, checked in by Mattia Monga, 14 years ago |
Importazione sorgenti
|
-
Property svn:executable
set to
*
|
File size:
460 bytes
|
Line | |
---|
1 | #! /bin/bash
|
---|
2 |
|
---|
3 | turno=1
|
---|
4 |
|
---|
5 | function p1(){
|
---|
6 | for i in $(seq 1 10); do
|
---|
7 | local ddone=$(false)
|
---|
8 | while ! [ $ddone ]; do
|
---|
9 | while [ $turno -eq 2 ]; do
|
---|
10 | echo $i
|
---|
11 | ddone=$(true)
|
---|
12 | turno=2
|
---|
13 | done
|
---|
14 | done
|
---|
15 | done
|
---|
16 | }
|
---|
17 |
|
---|
18 | function p2(){
|
---|
19 | for i in $(seq 11 20); do
|
---|
20 | local ddone=$(false)
|
---|
21 | while ! [ $ddone ]; do
|
---|
22 | while [ $turno -eq 1 ]; do
|
---|
23 | echo $i
|
---|
24 | ddone=$(true)
|
---|
25 | turno=1
|
---|
26 | done
|
---|
27 | done
|
---|
28 | done
|
---|
29 | }
|
---|
30 |
|
---|
31 | p1 & p2 &
|
---|
32 | wait %1 %2
|
---|
Note:
See
TracBrowser
for help on using the repository browser.