testmark-bash

todos.sh

#!/bin/bash
## todos.sh lists the lines of files that mention TODO, as "FILE:LINE:TEXT".
set -euo pipefail
for file in "$@"; do
	n=0
	while IFS= read -r line; do
		n=$((n + 1))
		if [[ $line == *TODO* ]]; then
			printf '%s:%d:%s\n' "$file" "$n" "$line"
		fi
	done <"$file"
done

examples/todos.sh · 279 B · f074f81300