Mac OS Terminal Scripting

I’ll start out by apologizing for this being somewhat off topic; I looked through the support forums, and this was about as close as it gets.

Here’s what I’ve got going on. I have a Macbook Pro running Mac OS ver. 10.13.6) and MAMP 5.1. I have multiple Drupal sites in development, each is in its own folder in MAMP’s htdocs folder. Each has been installed using Composer. For updates, rather than having to manually go in to each folder one by one, and enter <code>composer update</code>, I wrote a script which basically reads

<code>
cd /Applications/MAMP/htdocs
cd [folder 1]
/Applications/MAMP/htdocs/enstaller.command
composer update
cd ..
cd [folder 2]
/Applications/MAMP/htdocs/enstaller.command
composer update
cd ..
cd [folder 3]…
</code>

the “enstaller.command” is a 2nd script that will install whatever module or whatever via the “composer require…”  command. Just saves me having to type the same thing over and over.

Pretty simple, pretty basic. The question that brings me here is, currently, if I start developing a new site, I have to manually go into the script and add code to include the new folder(s) in this process. What I would LIKE to be able to do is basically tell it, “Go into the first folder, run the install script and do a ‘composer update’, return to the htdocs root, enter the next folder and repeat this process for every folder in htdocs. But I can’t seem to figure out how. Is there a way to issue a recursive command like this? I asked this over Apple’s Mac os forum, and they looked at me like I had three heads. They couldn’t understand what it was that I was wanting to do, despite multiple attempts to explain. So, I figured I’d ask over here, where hopefully y’all better get what I’m talking about.


Source: https://www.drupal.org/taxonomy/term/22/feed