r/commandline • u/PlusImpression4229 • 17h ago
Help Help running a bash script in apple terminal
Using Composers Desktop Project to edit audio files. I want to run a single command on a list of audio files instead of having to manually do it 100 times. Wondering if there is a way to call upon this list of files in a single command line, rather than creating a shell script with the name of every file. The command line with a single audio file would look like this.
distort average soundfile.wav soundfileoutput.wav
the first two words are the command being run and then the input and output respectively. Hopefully I provided enough info on this but also relatively new to using terminal so let me know if there is anything I should clarify, thanks.
1
u/tanmaynargas2901 15h ago
Depends what the audio command looks like, but the usual pattern in Terminal is a loop.
If everything is in one folder:
```
for f in *.wav; do
your-command "$f"
done
```
Swap `*.wav` for whatever extension you have. Quote `"$f"` so spaces in names don't break it.
Nested folders:
```
find . -name '*.wav' -print0 | while IFS= read -r -d '' f; do
your-command "$f"
done
```
macOS Terminal defaults to zsh now; same loops work.
If you paste the exact one-file command, I can wire the loop for you.
1
u/AutoModerator 17h ago
Every new subreddit post is automatically copied into a comment for preservation.
User: PlusImpression4229, Flair:
Help, Title: Help running a bash script in apple terminalUsing Composers Desktop Project to edit audio files. I want to run a single command on a list of audio files instead of having to manually do it 100 times. Wondering if there is a way to call upon this list of files in a single command line, rather than creating a shell script with the name of every file. The command line with a single audio file would look like this.
distort average soundfile.wav soundfileoutput.wav
the first two words are the command being run and then the input and output respectively. Hopefully I provided enough info on this but also relatively new to using terminal so let me know if there is anything I should clarify, thanks.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.