Skip to content

Instantly share code, notes, and snippets.

@eaybek
Last active September 28, 2015 17:33
Show Gist options
  • Save eaybek/3655dbaa33c76bfff43f to your computer and use it in GitHub Desktop.
Save eaybek/3655dbaa33c76bfff43f to your computer and use it in GitHub Desktop.
run command for all file in a folder
#!/bin/bash
for f in $1/*
do
if [ -f "$f" ]
then
cmd=${2/__file__/$f}
$cmd
fi
done
#usage sample
#fif ~/path/for/file "echo __file__"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment