LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Executing a command on every file in a directory (https://www.linuxquestions.org/questions/linux-newbie-8/executing-a-command-on-every-file-in-a-directory-193060/)

asciimonster 06-13-2004 03:16 PM

Executing a command on every file in a directory
 
I would like to automate my command-line operations a little...
I have a command that asks for a file at stdin as such:

command (lots of arguments) < file

But I have to do this for every file in the directory. Since wildcards are obviously not allowed:
command (lots of arguments) < *

Is there an easy way to accomplish this?

Mara 06-13-2004 03:25 PM

Maybe something like this:
Code:

for i in *; do command < $i; done

asciimonster 06-14-2004 03:46 AM

Yep! That worked!!

Thanks


All times are GMT -5. The time now is 05:46 PM.