1 2 3 4 5 6
#!/bin/sh # TODO: handle #!/usr/bin/env somehow while read filename; do sed -n -e '1s:^#![[:space:]]*\([^[:space:]]*\).*:\1:p' "$filename" done