LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices

Reply
 
Search this Thread
Old 06-13-2004, 03:16 PM   #1
asciimonster
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, 03:25 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,536

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

Original Poster
Rep: Reputation: 0
Talking

Yep! That worked!!

Thanks
 
  


Reply


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 5 06-30-2006 03:00 AM
Is there a command that alerts when a directory/file changes? davee Linux - General 1 09-19-2005 08:46 AM
Crawling a directory and executing Python functions. Travis86 Programming 2 07-06-2005 01:06 AM
PostgreSQL: executing a .SQL file from command line? J_Szucs Linux - Software 0 09-24-2003 11:49 PM
linux command error message bash: /usr/bin/find: No such file or directory sundaram123 Linux - General 8 04-02-2002 07:18 AM


All times are GMT -5. The time now is 05:20 AM.

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