Is there a way to set the pipe capacity of pipes defined in a Bash (or other shell) script? Take e.g.cmd1 | cmd2In recent Linuxes the pipe capacity is set to 64KB by default. I know I can control the amount of data buffered between the two processes in two ways:Using buffer(1): e.g. cmd1 | buffer | cmd2Using fcntl(2) with the F_SETPIPE_SZ flag from inside cmd1 or cmd2Each solution has downsides: buffer can only be used to increase the buffer; also writes over the default pipe capacity will still require waking up the downstream command. fcntl, as far as I know, can only be called from inside cmd1 or cmd2.My question is: is there a way, when the shell creates the pipe, to specify in the shell how much capacity the pipe should have?
Set pipe capacity in Linux
linux;bash;shell;pipe
Based on DepressedDaniel and Stphane Chazelas suggestions I settled on the closest thing to a oneliner I could find:function hugepipe {  perl -MFcntl -e 'fcntl(STDOUT, 1031, 1048576) or die $!; exec { $ARGV[0] } @ARGV or die $!' $@}This allows to do:hugepipe <command> | <command>and the pipe between the two commands is going to have the capacity specified via the fcntl in the perl script.