So our homework is to calculate Easter using some calculations:
p = v1+v2
v1 = (6*v2+m4+m2) mod 7
v2 = (16+m19 ) mod 30
m2 = 2*(year mod 4)
m4 = 4*(year mod 7)
m19 = 19*(year mod 19)
So these are the calculations we need to translate to Bash. This is what I have done so far with little luck:
read -p year
Am19=$(expr year%19)
m19=$(19*(Am19))
Am4=$(expr year%7)
m4=$(19*(Am4))
Am2=$(expr year%4)
m2=$(2*(Am2))
Av2=$(16+(m19))
v2=$(expr Av2%30)
Av1=$(6*(v2)+m4+m2)
v1=$(expr Av1%7)
p=$(v1+v2)
echo "$p"
The user is supposed to input a year with the read command (like 2000) And the program should give back the number $p I get these errors
main.sh: command substitution: line 5: syntax error near unexpected token `Am19'
main.sh: command substitution: line 5: `19*(Am19))'
main.sh: command substitution: line 7: syntax error near unexpected token `Am4'
main.sh: command substitution: line 7: `19*(Am4))'
main.sh: command substitution: line 9: syntax error near unexpected token `Am2'
main.sh: command substitution: line 9: `2*(Am2))'
main.sh: command substitution: line 10: syntax error near unexpected token `m19'
main.sh: command substitution: line 10: `16+(m19))'
main.sh: command substitution: line 12: syntax error near unexpected token `v2'
main.sh: command substitution: line 12: `6*(v2)+m4+m2)'
main.sh: line 13: v1+v2: command not found
And I got no clue whats going on, Any help is always appreciated, thank you all