diff options
Diffstat (limited to 'scripts/osm')
29 files changed, 0 insertions, 350 deletions
diff --git a/scripts/osm/josm_install.sh b/scripts/osm/josm_install.sh deleted file mode 100755 index 520875a..0000000 --- a/scripts/osm/josm_install.sh +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | # scripts from https://josm.openstreetmap.de/wiki/Download#Webstart | ||
4 | echo deb https://josm.openstreetmap.de/apt $(lsb_release -sc) universe | sudo tee /etc/apt/sources.list.d/josm.list > /dev/null &&\ | ||
5 | wget -q https://josm.openstreetmap.de/josm-apt.key -O- | sudo apt-key add - &&\ | ||
6 | sudo apt-get update &&\ | ||
7 | sudo apt-get remove josm josm-plugins &&\ | ||
8 | sudo apt-get install josm | ||
diff --git a/scripts/osm/osm b/scripts/osm/osm deleted file mode 100644 index a595fb7..0000000 --- a/scripts/osm/osm +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | #! /bin/sh | ||
2 | |||
3 | #export OSM_SERVER=https://master.apis.dev.openstreetmap.org | ||
4 | export OSM_SERVER=https://api.openstreetmap.org | ||
5 | |||
6 | export OSM_API=$OSM_SERVER/api/0.6 | ||
7 | export OSM_USER_PASSWD=$(cat $SETTING_DIR/tokens/osm 2>/dev/null) | ||
8 | |||
9 | FILENAME=$0 | ||
10 | |||
11 | utils.osm() { | ||
12 | vim $FILENAME && source $FILENAME | ||
13 | } | ||
14 | |||
15 | osm.api() { | ||
16 | curl -X GET $OSM_API/$1/$2 | ||
17 | } | ||
diff --git a/scripts/osm/osm.api.changeset.add b/scripts/osm/osm.api.changeset.add deleted file mode 100755 index 3e4878e..0000000 --- a/scripts/osm/osm.api.changeset.add +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | element=$(cat) | ||
4 | header=$(echo $element | grep -E "<(node|way|relation)\s") | ||
5 | ele_type=$(echo $header | sed -r 's/.*<(node|way|relation).*$/\1/') | ||
6 | id=$(echo $header | sed -r 's/.* id=\"([^"]+)\".*$/\1/') | ||
7 | |||
8 | echo $element | \ | ||
9 | sed -r "s/^( *<(node|way|relation).*version[^ ]+ )(.*)$/\1changeset=\"$1\">/" | \ | ||
10 | curl -X PUT -u $OSM_USER_PASSWD -i -T - $OSM_API/$ele_type/$id | ||
diff --git a/scripts/osm/osm.api.changeset.close b/scripts/osm/osm.api.changeset.close deleted file mode 100755 index 3b016c3..0000000 --- a/scripts/osm/osm.api.changeset.close +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | curl -X PUT -u $OSM_USER_PASSWD -i $OSM_API/changeset/$1/close | ||
diff --git a/scripts/osm/osm.api.changeset.create b/scripts/osm/osm.api.changeset.create deleted file mode 100755 index ed2601a..0000000 --- a/scripts/osm/osm.api.changeset.create +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | echo -n "type comment: " | ||
4 | read comment | ||
5 | |||
6 | info="<osm> | ||
7 | <changeset> | ||
8 | <tag k='comment' v='$comment'/> | ||
9 | <tag k='created_by' v='bash script'/> | ||
10 | <tag k='bot' v='yes'/> | ||
11 | </changeset> | ||
12 | </osm> | ||
13 | " | ||
14 | |||
15 | changeset_id=$(echo $info |\ | ||
16 | curl -u $OSM_USER_PASSWD --upload-file - $OSM_API/changeset/create |\ | ||
17 | tail -1) | ||
18 | |||
19 | echo | ||
20 | echo "changeset created, check $OSM_SERVER/changeset/$changeset_id" | ||
21 | echo "$changeset_id is copied into clipboard" | ||
diff --git a/scripts/osm/osm.api.changeset.update b/scripts/osm/osm.api.changeset.update deleted file mode 100755 index 7b32741..0000000 --- a/scripts/osm/osm.api.changeset.update +++ /dev/null | |||
@@ -1,7 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | echo -n 'type comment: ' | ||
4 | read -r comment | ||
5 | |||
6 | echo "<osm><changeset><tag k=\"comment\" v=\"$comment\"/></changeset></osm>" | \ | ||
7 | curl -X PUT -u $OSM_USER_PASSWD -i -T - $OSM_API/changeset/$1 | ||
diff --git a/scripts/osm/osm.api.changeset.upload b/scripts/osm/osm.api.changeset.upload deleted file mode 100755 index 96bdff4..0000000 --- a/scripts/osm/osm.api.changeset.upload +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | cat $2 |\ | ||
4 | sed -r "/<(node|way|relation)/ s/>/ changeset=\"$1\">/" |\ | ||
5 | tee /dev/tty |\ | ||
6 | curl -X POST -u $OSM_USER_PASSWD -i -T - $OSM_API/changeset/$1/upload | ||
diff --git a/scripts/osm/osm.api.fetch b/scripts/osm/osm.api.fetch deleted file mode 100755 index 8460c5f..0000000 --- a/scripts/osm/osm.api.fetch +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #! /bin/sh | ||
2 | |||
3 | # get .osm format data | ||
4 | curl -X GET $OSM_API/$1/$2 |\ | ||
5 | tee /tmp/osm &&\ | ||
6 | echo content of $1 $2 is copied into /tmp/osm > /dev/tty | ||
diff --git a/scripts/osm/osm.api.fetch.full b/scripts/osm/osm.api.fetch.full deleted file mode 100755 index 5ee78b8..0000000 --- a/scripts/osm/osm.api.fetch.full +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | #! /bin/sh | ||
2 | |||
3 | curl -X GET $OSM_API/$1/$2/full |\ | ||
4 | tee /tmp/osm &&\ | ||
5 | echo "\n" content of $1 $2 and its members are copied into /tmp/osm > /dev/tty | ||
diff --git a/scripts/osm/osm.api.fetch.history b/scripts/osm/osm.api.fetch.history deleted file mode 100755 index bc837bd..0000000 --- a/scripts/osm/osm.api.fetch.history +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #! /bin/sh | ||
2 | |||
3 | curl -X GET $OSM_API/$1/$2/history |\ | ||
4 | tee /tmp/osm &&\ | ||
5 | echo &&\ | ||
6 | echo "\n" history of $1 $2 are copied into /tmp/osm > /dev/tty | ||
diff --git a/scripts/osm/osm.api.member.relation b/scripts/osm/osm.api.member.relation deleted file mode 100755 index 5addef7..0000000 --- a/scripts/osm/osm.api.member.relation +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | #! /bin/sh | ||
2 | |||
3 | osm.api.referenced.relation $1 $2 |\ | ||
4 | osm.member.relation $1 $2 $3 | ||
diff --git a/scripts/osm/osm.api.referenced.relation b/scripts/osm/osm.api.referenced.relation deleted file mode 100755 index 2ce0631..0000000 --- a/scripts/osm/osm.api.referenced.relation +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #! /bin/sh | ||
2 | |||
3 | curl -X GET $OSM_API/$1/$2/relations |\ | ||
4 | tee /tmp/osm &&\ | ||
5 | echo &&\ | ||
6 | echo "\n" relations contain $1 $2 are copied into /tmp/osm > /dev/tty | ||
diff --git a/scripts/osm/osm.api.referenced.way b/scripts/osm/osm.api.referenced.way deleted file mode 100755 index 1d84238..0000000 --- a/scripts/osm/osm.api.referenced.way +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | curl -X GET $OSM_API/node/$1/ways |\ | ||
4 | tee /tmp/osm &&\ | ||
5 | echo ways contain node $1 are copied into /tmp/osm > /dev/tty | ||
diff --git a/scripts/osm/osm.api.upload.to b/scripts/osm/osm.api.upload.to deleted file mode 100755 index 3979220..0000000 --- a/scripts/osm/osm.api.upload.to +++ /dev/null | |||
@@ -1,12 +0,0 @@ | |||
1 | #! /bin/sh | ||
2 | |||
3 | # allows multiple elements in osm body | ||
4 | tee /tmp/osm |\ | ||
5 | osm.list.ids |\ | ||
6 | sed 's#.*#osm.extract \0 < /tmp/osm#g' |\ | ||
7 | sed "s/.*/\0 \| osm.api.changeset.add $1/g" |\ | ||
8 | while read -r command | ||
9 | do | ||
10 | echo $command | ||
11 | source<(echo "($command &)") | ||
12 | done | ||
diff --git a/scripts/osm/osm.file.get b/scripts/osm/osm.file.get deleted file mode 100755 index e2b67b4..0000000 --- a/scripts/osm/osm.file.get +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | #! /bin/sh | ||
2 | |||
3 | file=$1; shift | ||
4 | osmium getid $file $@ --output-format=osm | ||
diff --git a/scripts/osm/osm.file.get.full b/scripts/osm/osm.file.get.full deleted file mode 100755 index 50ee2f1..0000000 --- a/scripts/osm/osm.file.get.full +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | #! /bin/sh | ||
2 | |||
3 | file=$1; shift | ||
4 | osmium getid $file $@ --output-format=osm --add-referenced | ||
diff --git a/scripts/osm/osm.file.query b/scripts/osm/osm.file.query deleted file mode 100755 index 4a01b5b..0000000 --- a/scripts/osm/osm.file.query +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | #! /bin/sh | ||
2 | |||
3 | file=$1; shift | ||
4 | osmium tags-filter $file $@ --output-format=osm --omit-referenced | ||
diff --git a/scripts/osm/osm.goto b/scripts/osm/osm.goto deleted file mode 100755 index 25bceaa..0000000 --- a/scripts/osm/osm.goto +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | xdg-open https://www.openstreetmap.org/$1/$2 | ||
diff --git a/scripts/osm/osm.help b/scripts/osm/osm.help deleted file mode 100755 index aa3b36b..0000000 --- a/scripts/osm/osm.help +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | #! /bin/sh | ||
2 | |||
3 | echo ' | ||
4 | COMMANDS: | ||
5 | osm.help | ||
6 | util.osm.edit | ||
7 | |||
8 | osm.api.changeset.create create a new changeset and return its ID | ||
9 | osm.api.changeset.update [changeset ID] update changeset with new comment | ||
10 | osm.api.changeset.upload [changeset ID] [osc file] upload osc file to the given changeset | ||
11 | osm.api.changeset.add [changeset ID] STDIN=osm element, add it into changeset | ||
12 | osm.api.changeset.close [changeset ID] close the given changeset | ||
13 | osm.api.fetch [element type] [element ID] | ||
14 | osm.api.fetch.full like .fetch, but return with all referenced elements | ||
15 | osm.api.fetch.history [element type] [element ID] | ||
16 | osm.api.member.relation [element type] [element ID] [member type] get first relations reference it as member type | ||
17 | osm.api.referenced.relation [element type] [element ID] get all relations reference this element | ||
18 | osm.api.referenced.way [element type] [element ID] get all ways reference this element | ||
19 | osm.api.upload.to | ||
20 | |||
21 | osm.file.cat | ||
22 | osm.file.get | ||
23 | osm.file.get.full | ||
24 | osm.file.query | ||
25 | osm.list.ids | ||
26 | osm.list.tag | ||
27 | osm.list.tags | ||
28 | |||
29 | osm.get.id | ||
30 | osm.query | ||
31 | osm.member.relation | ||
32 | osm.pbf.update | ||
33 | osm.osm.update | ||
34 | ' | ||
diff --git a/scripts/osm/osm.list.ids b/scripts/osm/osm.list.ids deleted file mode 100755 index 8e5d870..0000000 --- a/scripts/osm/osm.list.ids +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | #! /bin/sh | ||
2 | |||
3 | sed -nr 's/.*<(node|way|relation) id=\"([^"]+)\".*/\1 \2/p' | ||
diff --git a/scripts/osm/osm.list.tag b/scripts/osm/osm.list.tag deleted file mode 100755 index 76649a0..0000000 --- a/scripts/osm/osm.list.tag +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | ele_pattern="(node|way|relation)" | ||
4 | sed -nr "/<$ele_pattern/,/<\/$ele_pattern/ { | ||
5 | /<tag k=\"$1\"/ { | ||
6 | s/.*v=\"([^\"]+)\".*/\1/ | ||
7 | h | ||
8 | } | ||
9 | /<\/$ele_pattern/ {x;p;s/.*//;x} | ||
10 | }" | ||
diff --git a/scripts/osm/osm.list.tags b/scripts/osm/osm.list.tags deleted file mode 100755 index 767d32a..0000000 --- a/scripts/osm/osm.list.tags +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | content=$(cat) | ||
4 | echo $content | osm.list.ids | tr ' ' ',' > /tmp/osm | ||
5 | |||
6 | for tag in $@ | ||
7 | do | ||
8 | echo $content |\ | ||
9 | osm.list.tag $tag |\ | ||
10 | paste -d',' /tmp/osm - > /tmp/osm.new &&\ | ||
11 | mv /tmp/osm.new /tmp/osm | ||
12 | done | ||
13 | |||
14 | cat /tmp/osm | ||
15 | echo "\ntag list is also copied into /tmp/osm" > /dev/tty | ||
diff --git a/scripts/osm/osm.member.relation b/scripts/osm/osm.member.relation deleted file mode 100755 index f8d4598..0000000 --- a/scripts/osm/osm.member.relation +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | #! /bin/sh | ||
2 | |||
3 | sed -nr "/<relation/,/<\/relation/ { | ||
4 | /<relation/ {s/.* id=\"([^\"]+)\".*/\1/;h} | ||
5 | /<member type=\"$1\" ref=\"$2\" role=\"$3\"/ {g;p;q} | ||
6 | } | ||
7 | $ {s/.*//;P} | ||
8 | " | head -1 | ||
diff --git a/scripts/osm/osm.osc.by_member b/scripts/osm/osm.osc.by_member deleted file mode 100755 index 5f9d9be..0000000 --- a/scripts/osm/osm.osc.by_member +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | while read -r line | ||
4 | do | ||
5 | |||
6 | TYPE=$(echo $line | cut -d ' ' -f1) # field1 is type | ||
7 | ID=$(echo $line | cut -d ' ' -f2) # field2 is ID | ||
8 | |||
9 | NEW_MEMBERS=$(echo $line |\ | ||
10 | cut -d' ' -f3- |\ | ||
11 | sed -r 's/([0-9]+)/<member type=\"relation\" ref=\"\1\" role=\"subarea\"\/>/g') | ||
12 | |||
13 | echo $NEW_MEMBERS | ||
14 | |||
15 | # print matched element with new tags to .osc file | ||
16 | cat $1 |\ | ||
17 | sed -nr "/<$TYPE id=\"$ID\"/,/<\/$TYPE/ { | ||
18 | /<$TYPE id=\"$ID\"/ { | ||
19 | s/(version=\"[0-9]+\")(.*)/\1>/ | ||
20 | a \ \ \ \ $NEW_MEMBERS | ||
21 | } | ||
22 | p | ||
23 | /<\/$TYPE/ q | ||
24 | }" >> $1.osc | ||
25 | done | ||
26 | |||
27 | # Add .osc structure for output | ||
28 | sed -ir '1 i <osmChange version="0.6" generator="bash script"> | ||
29 | 1 i <modify> | ||
30 | $ a </modify> | ||
31 | $ a </osmChange>' $1.osc | ||
diff --git a/scripts/osm/osm.osc.by_tag b/scripts/osm/osm.osc.by_tag deleted file mode 100755 index cc92c1d..0000000 --- a/scripts/osm/osm.osc.by_tag +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | # create new tags from input line, for example: | ||
4 | # field1 field2 field3 field4 field5 field6 field7 field8... | ||
5 | # [element type] [element ID] key1_added "value1" key2_added "value2" key3_removed key4_removed... | ||
6 | |||
7 | # key should not quoted, value must be quoted | ||
8 | # And keys which need to be removed must be placed at the end | ||
9 | while read -r line | ||
10 | do | ||
11 | TYPE=$(echo $line | cut -d ' ' -f1) # field1 is type | ||
12 | ID=$(echo $line | cut -d ' ' -f2) # field2 is ID | ||
13 | |||
14 | # transform key-value pair into tag format: | ||
15 | # <tag k="[key]" v="[value]"/> | ||
16 | # keys without values are omitted | ||
17 | NEW_TAGS=$(echo $line |\ | ||
18 | cut -d' ' -f3- |\ | ||
19 | sed -r 's/([^ "]+) (\"[^"]+\")/<tag k=\"\1\" v=\2\/>/g; s/>[^"]*$/>/') | ||
20 | |||
21 | # get regex pattern need to removed from original osm element: | ||
22 | # key1|key2|key3|key4 | ||
23 | TAG_PATTERN=$(echo $line |\ | ||
24 | cut -d' ' -f3- | xargs -n2 echo |\ | ||
25 | cut -d' ' -f1 | paste -s -d'|') | ||
26 | |||
27 | echo $NEW_TAGS > /dev/tty | ||
28 | |||
29 | # print matched element with new tags to .osc file | ||
30 | cat $1 |\ | ||
31 | sed -nr "/<$TYPE id=\"$ID\"/,/<\/$TYPE/ { | ||
32 | /<$TYPE id=\"$ID\"/ { | ||
33 | s/(version=\"[0-9]+\")(.*)/\1>/ | ||
34 | a \ \ \ \ $NEW_TAGS | ||
35 | } | ||
36 | /<tag k=\"($TAG_PATTERN)\"/ !p | ||
37 | /<\/$TYPE/ q | ||
38 | }" >> $1.osc | ||
39 | done | ||
40 | |||
41 | # Add .osc structure for output | ||
42 | sed -ir '1 i <osmChange version="0.6" generator="bash script"> | ||
43 | 1 i <modify> | ||
44 | $ a </modify> | ||
45 | $ a </osmChange>' $1.osc | ||
diff --git a/scripts/osm/osm.osm.remove b/scripts/osm/osm.osm.remove deleted file mode 100755 index 83d6ea8..0000000 --- a/scripts/osm/osm.osm.remove +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | while read -r line | ||
4 | do | ||
5 | # put element type and element ID into array | ||
6 | array=( $(echo $line) ) | ||
7 | cat $1 |\ | ||
8 | sed -i "/<$array[1] id=\"$array[2]\"/,/<\/$array[1]>/ d" | ||
9 | done | ||
diff --git a/scripts/osm/osm.pbf.update b/scripts/osm/osm.pbf.update deleted file mode 100755 index cd115a7..0000000 --- a/scripts/osm/osm.pbf.update +++ /dev/null | |||
@@ -1,39 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | GEOFABRICK_SERVER=http://download.geofabrik.de/asia/taiwan-updates | ||
4 | PBF_FILE=$1 | ||
5 | |||
6 | # get latest sequence number | ||
7 | echo Fetching the latest sequence number | ||
8 | LATEST_SEQ=$(curl --silent http://download.geofabrik.de/asia/taiwan-updates/state.txt |\ | ||
9 | tail -1 | cut -d'=' -f2) | ||
10 | echo Latest sequence number is $LATEST_SEQ | ||
11 | |||
12 | # get current sequence number | ||
13 | SEQ=$(osmium fileinfo $PBF_FILE |\ | ||
14 | grep osmosis_replication_sequence_number |\ | ||
15 | cut -d'=' -f2) | ||
16 | echo File sequence number is $SEQ | ||
17 | |||
18 | # while server has osc file with given sequence number, | ||
19 | # get it and do file update | ||
20 | while | ||
21 | (( SEQ++ )) | ||
22 | [ $SEQ -le $LATEST_SEQ ] | ||
23 | do | ||
24 | mkdir -p changes | ||
25 | SEQ_PATH=$(echo $SEQ | sed -r 's/(.{1})(.{3})/00\1\/\2/') | ||
26 | CHANGE_URL=$GEOFABRICK_SERVER/000/$SEQ_PATH.osc.gz | ||
27 | echo $CHANGE_URL | ||
28 | curl -o changes/$SEQ.osc.gz $CHANGE_URL && \ | ||
29 | osmium apply-changes $PBF_FILE changes/$SEQ.osc.gz \ | ||
30 | --output-header=osmosis_replication_sequence_number=$SEQ \ | ||
31 | --overwrite \ | ||
32 | --output $SEQ.osm.pbf | ||
33 | |||
34 | mv $PBF_FILE $((SEQ-1)).osm.pbf | ||
35 | mv $SEQ.osm.pbf $PBF_FILE | ||
36 | done | ||
37 | |||
38 | echo | ||
39 | echo File sequence number is $((SEQ-1)), already the latest one on Geofrbrik | ||
diff --git a/scripts/osm/osm.query b/scripts/osm/osm.query deleted file mode 100755 index 8d0b9f7..0000000 --- a/scripts/osm/osm.query +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | osmium tags-filter - $@ --input-format=osm --output-format=osm --omit-referenced | ||
diff --git a/scripts/osm/sequence_number.sh b/scripts/osm/sequence_number.sh deleted file mode 100755 index eb365d0..0000000 --- a/scripts/osm/sequence_number.sh +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | # $1 as --hour or --minute, $2 as timestamp | ||
4 | # return the latest sequence number | ||
5 | |||
6 | case $1 in | ||
7 | # hour difference with Tue Jun 4 03:00:00 UTC 2019 | ||
8 | # sequence number=58940 | ||
9 | --hour) | ||
10 | echo $[($2 - 1559617200)/3600 + 58940] | ||
11 | ;; | ||
12 | |||
13 | # minute difference with latest planet state file | ||
14 | --minute) | ||
15 | benchmark=benchmark | ||
16 | curl https://planet.openstreetmap.org/replication/minute/state > $benchmark | ||
17 | timeString=$(tail -1 $benchmark | tr -d 'timestamp=\\') | ||
18 | timestamp=$(date -d "$timeString" +%s) | ||
19 | seq=$(sed -n 2p $benchmark | tr -d "sequenceNumber=") | ||
20 | rm $benchmark | ||
21 | echo $[$seq - ($timestamp - $2)/60 - 1 ] | ||
22 | esac | ||