You're getting an
argument list too long error because you are not quoting your arguments. There's an expansion occurring - though it is difficult to say definitely what it is - on the value of
$file which generates more arguments. My theory is one of your filenames contains another
* which again expands out to match all of your matched files all over again.
You can do this in the shell - and you don't need to invoke a whole new shell via
find to do it either.
Just do this:
for f in ./*.fasta
do signalp "$f" >"$f.txt"
...see? The double-quotes will prevent the contents of the iterable shell variable
$f from being interpreted any way but literally - even if
$f does contain expandable metacharacters of kind.
Granted, though, this is not the best solution for groups of 18k files. It will work, but it would be better if you could batch it further.
As an example, let's assume there is some kind of order to the filenames themselves. Maybe they're named like...
And so on. In that case you could do something like:
for l in a b c d e f g h i j k l m n o p q r s t u v x y z
do for f in "./$l$l$l"*.fasta
do singalp "$f" >"$f.txt"
...and so you wouldn't need to retain the whole 18k list in memory for the duration of the loop.