File: makedata

package info (click to toggle)
dxsamples 4.4.0-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 26,340 kB
  • sloc: ansic: 10,079; sh: 8,445; java: 1,772; makefile: 1,102
file content (54 lines) | stat: -rwxr-xr-x 1,349 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh

# initialize the counter
i=1

# remove the temporary files, if they exist. This is in case this shell
# script is interupted before finishing and cleaning up.

/bin/rm tmpdata
/bin/rm tmppos
/bin/rm tmpheaddata
/bin/rm tmpheadpos
/bin/rm tmpheadfield
/bin/rm tmpdatafile.dx


while [ $i -lt 101 ]; do

   data=$((($i % 3) + ($i % 5) + ($i % 11) + ($i % 17)))

#  write out the new temp data file 
   echo "$data" >> tmpdata

#  write out the new temp positions file
   echo "$i" >> tmppos

#  write out the new temp header files
   echo "object 1 class array type float rank 1 shape 1 items $i" > tmpheadpos
   echo "   data follows" >> tmpheadpos
   echo "object 2 class array type float rank 0 items $i " > tmpheaddata
   echo "   data follows" >> tmpheaddata
   echo '   attribute "dep" string "positions" ' > tmpheadfield
   echo "object 3 class field" >> tmpheadfield
   echo '   component "positions" value 1' >> tmpheadfield
   echo '   component "data" value 2' >> tmpheadfield

#  put it all together 
   cat tmpheadpos tmppos tmpheaddata tmpdata tmpheadfield > tmpdatafile.dx
   mv tmpdatafile.dx datafile.dx

#  increment the counter
   i=$(($i + 1))

# pause for awhile
#  sleep 1
done

# remove temporary files
/bin/rm tmpdata
/bin/rm tmppos
/bin/rm tmpheaddata
/bin/rm tmpheadpos
/bin/rm tmpheadfield
/bin/rm tmpdatafile.dx