Bash scripts that bill twelve homes for water at the HIPPAM post: awk, sed, trap, export and tar. 16 levels, right in the browser.
What the levels ask
Saturday morning, 3 October. Mr. Darmin's app sends this week's meter readings to the HIPPAM post's laptop as masuk/meter.csv: house number, name, the start reading, the end reading, and the neighbourhood, separated by commas. Each house gets a bill with its name and how many cubic metres of water it used. Pick what awk prints after the name.
Mr. Darmin turned on include column names in his app and sent the readings again. Now the first line of masuk/meter.csv is no,nama,awal,akhir,rt. Pick the pattern in front of awk's action so that only houses are billed.
The neighbourhood head wants the board at the post to show how many cubic metres each neighbourhood used this week. The script rekap.sh adds the use into the array pakai and prints it in the END block. Pick the array's key that groups by neighbourhood.
Saturday, 10 October. Mr. Darmin now copies his readings through a spreadsheet, and some lines come back with spaces at their end, after the neighbourhood's name. The neighbourhood head's board now shows the same neighbourhood twice. Pick the sed command that tidies masuk/meter.csv before it is summed.
Mr. Darmin's new app puts the reading's time in front of every line, like [07:11], and marks a meter that must be read again with [cek] after the name. Every mark in brackets must go, but the rest of the line must stay. Pick the sed command that cleans it.
This week the readings came over WhatsApp, one file per neighbourhood, and Mr. Darmin's phone named the last one meter RT03.csv, with a space. The script tagih.sh loops over every file in masuk/. Pick how the file's name is given to awk.
The neighbourhood head compares the board with the main meter at the water tower. The main meter says the village used 91 cubic metres this week, but the board says otherwise, and the neighbourhood head starts to suspect a leaking pipe. The function pakai_rt in rekap.sh uses a variable called total, the name its caller uses too. Pick the function's first line.
Saturday, 17 October. Mr. Darmin is ill, and this week's readings may not come. If masuk/meter.csv is not there, tagih.sh must stop with a message on stderr and a non-zero exit code, without overwriting last week's laporan/tagihan.txt. If it is there, the bills are made as usual. Pick the line that checks.
RT04 by the river joined this week, and rt04.sh sums the use of its three houses with grep and then awk. If RT04's readings have not come in, the script must stop and send no bills. Pick the safety line at the top of the script.
The script daftar.sh writes the name of every billed house to laporan/daftar.txt, in alphabetical order, then announces how many houses were billed. Yesterday it announced zero houses, though the list was complete. Pick the line that closes its loop.
Saturday, 24 October. The district sent cetak-tagihan.sh to print rupiah bills in the official format. That script reads TARIF and BULAN from its environment. tagih.sh already sets both, yet the bills still print Rp 0. Pick the line that gives both to the district's script.
The Al-Ikhlas mosque and the Mawar health post get their water free. masuk/sosial.csv must be printed with a rate of 0, while the villagers' bills after it stay Rp 3,000 per cubic metre. Pick the start of the printing line for the free rate.