LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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 04-18-2005, 07:57 PM   #1
jerryfreak
LQ Newbie
 
Registered: Jul 2004
Posts: 9

Rep: Reputation: 0
executing a script in multiple subdirectories


I have a script that processes all of the files in a given directory, I would like to automate the script to process a series of subdirectories the same way

the current script is as follows:

shn2make -k ; make ogg
This must be run from a shell in the given directory, but how do I do it from a higher directory, to run the script within each subdirectory?

TIA,
jamie
 
Old 04-19-2005, 08:34 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Squeeze
Posts: 5,739

Rep: Reputation: 298Reputation: 298Reputation: 298
Enclose it in a for-next type loop. Include the command to 'cd <higher directory>', then,
for each <subdirectory> in <higher directory>,
do
cd $subdirectory
do 'whatever you want it to do',
done.

I hope you realize this is quasi-psuedo code. But it should convey the general idea of my suggestion.

Last edited by bigrigdriver; 04-19-2005 at 08:35 PM.
 
  


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
Using Bash, Find script files in a directory or subdirectories within... ray5_83 Programming 4 10-10-2008 07:42 PM
executing a script!! vishamr2000 Linux - Security 5 07-29-2005 02:34 AM
executing multiple commands by ssh jpan Linux - General 1 10-22-2004 02:12 PM
Creating subdirectories within multiple exisitng direcotries jse580 Linux - Newbie 5 10-02-2003 12:18 PM
Script For Moving Files In Subdirectories darkmage Linux - General 3 12-17-2002 06:34 PM


All times are GMT -5. The time now is 09:21 PM.

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