#!/bin/bash # Specify the directory dir="." # Loop over all .sy files in the directory find "$dir"/*/sy -type f -name "*.sy" -print0 | while IFS= read -r -d '' file; do # Use sed to add #include "sylib.h" at the beginning of each file sed -i '1i#include "sylib.h"' "$file" done