Different pipeline behavior between sh and ksh
问题 I have isolated the problem to the below code snippet: Notice below that null string gets assigned to LATEST_FILE_NAME='' when the script is run using ksh ; but the script assigns the value to variable $LATEST_FILE_NAME correctly when run using sh . This in turn affects the value of $FILE_LIST_COUNT . But as the script is in KornShell (ksh), I am not sure what might be causing the issue. When I comment out the tee command in the below line, the ksh script works fine and correctly assigns the