diff options
Diffstat (limited to 'ziglings')
| -rwxr-xr-x | ziglings | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -1,5 +1,8 @@ #!/bin/bash +# ziglings takes one parameter: the exercise number to jump to +jump_to=${1:-0} + echo echo " _ _ _ " echo " ___(_) __ _| (_)_ __ __ _ ___ " @@ -14,11 +17,20 @@ fmt_err=$( tput setaf 1 ) # red foreground fmt_yay=$( tput setaf 2 ) # green foreground fmt_off=$( tput sgr0 ) # reset colors/effects +exercise_num=0 + function check_it { source_file=$1 correct_output=$2 hint=$3 + # If the current exercise is less than the requested one, skip it + let exercise_num+=1 + if [[ $exercise_num -lt $jump_to ]] + then + return + fi + # Compile/run the source and capture the result and exit value cmd="zig run $source_file" echo "$ $cmd" @@ -55,6 +67,7 @@ function check_it { check_it 01_hello.zig "Hello world" "Note the error: the source file has a hint for fixing 'main'." check_it 02_std.zig "Standard Library" +check_it 03_assignment.zig "55 314159 -11" echo echo " __ __ _ " |
