I have a encrypt function that goes like this:
encrypt -a aes -k key **-i input.file** -o output.file
which take in 1 input file and output 1 file as well.
By using pipe:
echo "abc" | encrypt -a aes -k key -o output.file
Q1) How does the “encrypt” function know or the OS know that the output for the pipe | is suppose to be the input for the encrypt function (so that i didn’t need to specify the “-i input.file” parameter) ?
Q2 Why does redirection works in this case ?
echo “abc” > encrypt -a aes -k key -o output.file