redirect stdandard input using close dup and dup2