Connection with Teradata through shell Script

Hi All,

As we are using SQLPLUS command to connect Oracle Database in unix:
Like below syntax:

 
sqlplus username/password@dbname << EOI
 SET HEADING OFF
 SPOOL MAX_DATE_VAL.txt
 select max(LAST_UPDT_DATE) from source_defect;
 SPOOL OFF
  
 

here the result is stored in a file named MAX_DATE_VAL.txt.

How can we do the same with Teradata?

Need to store the Teradata query result in a file.