I'm running up against the "argument list too long" problem using a command in the shell (bash in my case). Most suggestions for working around this suggest using find or some variation, presuming that it's a long list of files that is exceeding the argument length limit.

However, in my case it's not a list of files but a list of arguments. I'm using the audio processing software sox and need to be able to use as many command line arguments as I want (depending on input audio file length). So, for example, a short version of a command I want might look like:

sox input.wav output.wav trim 0 1 gain 1 : trim 0 1 gain 2 : trim 0 1 gain 1

But instead of just three trim/gain arg pairs, I want it to go on for as long as I want (so imagine that it just keeps going with trim 0 1 gain X.

Is there any way to write a function to generate this in order to subvert the arg length limit? I tried some variations but can't seem to figure it out.

  • Look into xargs(1).
    – Spiff
    Jul 21, 2015 at 6:56
  • Wouldn't xargs invoke the main command many times? I want to be able to only execute the main command once with an unlimited number of arguments.
    – mix
    Jul 21, 2015 at 7:12
  • 2
    In that case, did you try sox’s --effects-file option?
    – Spiff
    Jul 21, 2015 at 7:25
  • Wow, thank you for the pointer. There was no mention of this option in any of the documentation that came with sox, though after your comment I found one mention in the ChangeLog, and then found info on the mailing list. This does solve my problem.
    – mix
    Jul 21, 2015 at 7:36
  • @spiff You might want to make an answer from your comment ;)
    – DavidPostill
    Jul 21, 2015 at 11:50

1 Answer 1


If a solution specific to sox would meet your immediate needs, I see from the sox(1) man page that it has an option --effects-file that lets you specify all your edits in a file instead of command line arguments.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.