]>
Softwares of Agnibho - mscore.git/blob - mscore
3 # Copyright (c) 2017 Agnibho Mondal
6 # This file is part of Mscore.
8 # Mscore is free software: you can redistribute it and/or modify it under the
9 # terms of the GNU General Public License as published by the Free Software
10 # Foundation, either version 3 of the License, or (at your option) any later
13 # Mscore is distributed in the hope that it will be useful, but WITHOUT ANY
14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
15 # PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License along with
18 # Mscore. If not, see <http://www.gnu.org/licenses/>.
24 DIR
= "/home/agnibho/program/mscore/data/" ;
42 REG
= $
( grep -Eo "\[.*?\]" <<< " $line " |
sed "s/[][]//g" |
sed "s/ //g" );
43 PR
= $
( echo " $line " |
sed "s/\[.*\]//g" ) "[ $REG ] : " ;
44 read -p " $PR " -u 3 IN
;
45 if [[ -z " $IN " ]]; then
48 if [[ " $IN " = ~
' ' ]]; then
50 elif [[ " $REG " = ~
- ]]; then
51 l
= $
( echo " $REG " |
sed "s/-.*//g" );
52 u
= $
( echo " $REG " |
sed "s/.*-//g" );
53 if (( " $IN " >= " $l " && " $IN " <= " $u " )); then
59 elif [[ " $REG " = ~
, ]]; then
60 readarray
-d , -t n
<<< " $REG " ;
61 if [[ " ${n[@]} " = ~
" $IN " ]]; then
67 elif [[ " $REG " = ~
[ yn
] ]]; then
68 if [[ " ${IN,,} " = ~
[ y1
] ]]; then
71 elif [[ " ${IN,,} " = ~
[ n0
] ]]; then
77 echo "Error processing [ $REG ]" ;
89 readarray
-t PATS
<<< "$(grep -Po " \
[ .
* ?\
] " <<< " $line ")" ;
90 for P
in " ${PATS[@]} " ; do
91 I
= "$(echo " $P " | sed " s
/[][]// g
" | sed " s
/ // g
" | sed " s
/ vt
/ $TOT / g
" | sed -r " s
/ v
([ 0 -9 ]+)/ $\
{ INPUT\
[ \
1 \
] \
}/ g
" | sed -r " s
/ g
([ 0 -9 ]+)/ $\
{ GROUP\
[ \
1 \
] \
}/ g
" | sed -r " s
/([= \
< \
>])/ \
1 / g
" | sed -r " s
/([ \
< \
>]) \s
+=/ \
1 =/ g
" | sed " s
/ and
/ \
& \
& / g
" | sed " s
/ or
/ \|\|
/ g
")" ;
92 if [[ " $I " = ~
[= \
< \
> \
& \|
] ]]; then
93 if ! eval "(( $I ))" ; then
97 elif [[ " $I " == "!" ]]; then
101 I
= $
( eval "echo $I " |
bc );
102 line
= ${line/"$P"/"$I"} ;
106 if [ " $FLAG " = "stop" ]; then
111 if [ -f " $DIR $1 " ]; then
114 if [[ " $line " = ~ ^
# ]];then
116 elif [[ " $line " = ~ ^
= ]]; then
117 if [ " $SECTION " = "input" ]; then
119 TOT
= $
( echo ${INPUT[@]} |
sed "s/ /+/g" |
bc );
120 GROUP
[ $G ]= $
( echo " ${GROUP[$G]} " |
bc );
123 elif [[ " $line " = ~ ^
- ]]; then
124 if [ " $SECTION " = "input" ]; then
125 GROUP
[ $G ]= $
( echo " ${GROUP[$G]} " |
bc );
130 elif [[ " $line " = ~ \
[ .
* ?\
] ]]; then
131 if [ " $SECTION " = "input" ]; then
133 elif [ " $SECTION " = "output" ]; then
144 echo "Available scores: " ;