Script to install Oracle client 12c2 on Redhat linux 7.5
That will not work, that is not how you execute commands as an other user. + Only root can run passwd username, not even oracle user can run passwd oracle.

sudo su oracle; echo Nbst@AWS01 | passwd oracle --stdin 
export ORACLE_BASE=/opt/app/oracle
export ORACLE_HOME=/opt/app/oracle/product/12.2.0/client_1
/tmp/client/runInstaller -silent -responseFile /tmp/client/client_install.rsp
exit


Use something like this:

echo Nbst@AWS01 | passwd oracle --stdin
sudo su oracle -c "export ORACLE_BASE=/opt/app/oracle;
export ORACLE_HOME=/opt/app/oracle/product/12.2.0/client_1;
/tmp/client/runInstaller -silent -responseFile /tmp/client/client_install.rsp"