Skip to content

Merge pull request #13 from tomii9273/debug_ga #5

Merge pull request #13 from tomii9273/debug_ga

Merge pull request #13 from tomii9273/debug_ga #5

name: Check Math Formula
on:
push:
branches:
- main
jobs:
check-math-formula:
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- uses: actions/checkout@v3
- name: List files in the src directory
run: ls -la src/
- name: Display the content of README.md
run: cat src/README.md
- name: Show version of grep
run: grep --version
- name: Check grep output for 'f'
run: |
echo "start 00"
grep 'f' src/README.md
echo "start 0"
grep -o 'f' src/README.md
echo "start 1"
grep -o 'f' src/README.md | wc -l
echo "start 2"
echo "Number of 'f': $(grep -o 'f' src/README.md | wc -l)"
echo "start 3"
c=$(grep -o 'f' src/README.md | wc -l)
echo "Number of 'f': $c"
echo "finished"
- name: Check grep output regexp
run: |
echo "start 0"
grep -E '^' src/README.md
echo "start 1"
grep -E '\$' src/README.md
echo "start 2"
grep '^' src/README.md
echo "start 3"
grep '\$' src/README.md
echo "finished"
- name: Check
run: |
echo "start"
n_head_line=$(grep -o '^\$' src/README.md | wc -l)
n_tail_line=$(grep -o '\$$' src/README.md | wc -l)
n_head_bracket=$(grep -o '(\$' src/README.md | wc -l)
n_tail_bracket=$(grep -o '\$)' src/README.md | wc -l)
n_head=$(grep -o ' \$' src/README.md | wc -l)
n_tail=$(grep -o '\$ ' src/README.md | wc -l)
n_valid=$((n_head_line+n_tail_line+n_head_bracket+n_tail_bracket+n_head+n_tail))
n_all=$(grep -o '\$' src/README.md | wc -l)
echo "count end"
echo $n_head_line
echo $n_tail_line
echo $n_head_bracket
echo $n_tail_bracket
echo $n_head
echo $n_tail
echo $n_valid
echo $n_all
echo "output end"
if [ $n_all -ne $n_valid ]; then
echo "not equal"
echo $n_all
echo $n_valid
exit 2
fi
echo "finished"
shell: bash