Sh, bash and csh
How to access a data which is set in child shell script from a parent script
The bourne shell cannot use 'export' to access the variables outside a loop. With a Bourne shell you need to reassign the descriptors, so no pipeline or redirection in loop is involved!
Therefore, use the following statements as required!
exec 3<&0 exec<file while read line; do x=$line done exec 0<&3
In the kourne shell use
execute < &CONFIG_FILE while read tmpLine do ... Done
Command line redirection
log_file=/tmp/command_log_file command | tee -a "$log_file"
tee has two output streams. One is an input to a file (using -a to append rather than overwrite) while the second copyies the input to standard output.