Help answer threads with 0 replies.
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 04-18-2005, 08:57 PM   #1
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?

Old 04-19-2005, 09:34 PM   #2
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,903

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

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 09:35 PM.


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 08:42 PM
executing a script!! vishamr2000 Linux - Security 5 07-29-2005 03:34 AM
executing multiple commands by ssh jpan Linux - General 1 10-22-2004 03:12 PM
Creating subdirectories within multiple exisitng direcotries jse580 Linux - Newbie 5 10-02-2003 01:18 PM
Script For Moving Files In Subdirectories darkmage Linux - General 3 12-17-2002 07:34 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:13 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