I've been trying to learn how one would use pascal programs to be used in shell scripts.
The original pascal used the program header to specify such input, output interfaces. ie;
Program foo(input, output, file1, file2) ;
The input and output are the standard in, out but are text file types. TurboPascal on DOS mostly forgot about this.
Building shell commands with pascal seems promising.