There are many ways to send or receive data from embedded code. Other language-embedded code can send data to Bash using piping, saving, writing, or printing. Other language-embedded code can receive data through variables, files, user input, or pipes.
The following is an example of other language code sending output to Bash using pipe:
ksh -c "ls" | cat > ./save_to_file
In the preceding command, ksh is sending directory content to bash by pipe, which will be stored in the file.
We can eliminate the use of pipe from the preceding example as follows:
ksh -c "ls" > ./save_to_file
As we have eliminated the use of pipe, the preceding command has become more efficient. It is better to eliminate the middleman if ...