Im wondering how to make this script work:
for f in *.php
do
for c in seq 1 $#
do
eval `eval echo \$$c`
done
done
The main idea of the script y to execute all commands passed to the script on every file, for example:
bash script.sh "grep text \$f" "echo \"Done!\""
Should be the same as:
for f in *.php
do
grep text $f
echo "Done!"
done
I think it’s pretty simple but I’ve been stuck here for long
Any help?
You can make it work like this:
A more common (and safer) approach would be
which could be run as
./yourscript grep text {}, but it doesn’t allow arbitrary shell constructs.