Run commands on multiple files and keep the same name… here is a solution to the problem.
Run commands on multiple files and keep the same name
How do I run shell commands on multiple files in Linux/Mac while keeping the same name (excluding extension)?
For example, let’s say I want to use the command to compile a list of files into some other file with the same name:
{command} [name].less [same-name].css
Solution
EDIT: More generally, assuming the two targets are in two different paths, such as “path/to/folder2” and “path/to/folder3”, keep in mind that you can always specify in a for loop, you can try:
for i in $(ls path/to/folder3 | grep .less); do . /path/to/folder1/script.sh $(echo "path/to/folder3/$i $( echo "path/to/folder2/$i" | sed -e s/.less/.css/)") ; done
Still sorry for the cruel and possibly inelegant solution.