#!/bin/bash dirs="$(ls . | tr ' ' '\n' | grep day)" echo "$dirs" | while read -r dir; do echo "Running $dir" cd "$dir"; make run; cd .. done