Where is the error in this script please:
#!/bin/bash
rep="git"
files=`find' ${rep} '-type f`
for f in ${files} do
echo $f
done
When i run find git -type f
alone in the shell, it works!
|
Remove quotes from files=`find '$rep' -type f` The correct script is #!/bin/bash rep="git" files=`find $rep -type f` for f in ${files}; do echo $f done |
|||||
|
Strings in single quotes are not interpolated. It means, you are trying to run
Remove the single quotes. If you really need to quote the $rep (e.g. because it contains spaces), use double quotes:
Note that there are no spaces inside the double quotes. You are searching 'git', not ' git ', right? |
|||
|
Don't store the output of
If you need to run an arbitrary shell snippet and not just a single command on each file, invoke a shell as the command. To avoid mangling the file name, pass it as a parameter to the shell.
|
|||
|