Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-13-2004, 04:16 PM   #1
LQ Newbie
Registered: Mar 2004
Posts: 20

Rep: Reputation: 0
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?
Old 06-13-2004, 04:25 PM   #2
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,692

Rep: Reputation: 232Reputation: 232Reputation: 232
Maybe something like this:
for i in *; do command < $i; done
Old 06-14-2004, 04:46 AM   #3
LQ Newbie
Registered: Mar 2004
Posts: 20

Original Poster
Rep: Reputation: 0

Yep! That worked!!



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
chroot: cannot run command `/tools/bin/env': No such file or directory Basel Linux From Scratch 10 06-09-2018 03:15 PM
Is there a command that alerts when a directory/file changes? davee Linux - General 1 09-19-2005 09:46 AM
Crawling a directory and executing Python functions. Travis86 Programming 2 07-06-2005 02:06 AM
PostgreSQL: executing a .SQL file from command line? J_Szucs Linux - Software 0 09-25-2003 12:49 AM
linux command error message bash: /usr/bin/find: No such file or directory sundaram123 Linux - General 8 04-02-2002 08:18 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:32 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration