#!/bin/bash

for dir in *; do
  [ -d $dir ] && pushd $dir && { "$@"; popd; }
done

