30

Consider:

#!/bin/bash

/u01/app/oracle/middleware/oracle_common/common/bin/wlst.sh <<!END
connect('user','pw');
p=redeploy('application');
p.printStatus();
exit();
!END

The above script is there to help me to perform a redeploy for weblogic application. The area I don't understand is wlst.sh <<!END as well as the last !END.

What's the function of both !END statements?

Isaac
  • 411

1 Answers1

50

It's a Here Document -- the lines between <<!END and !END are fed to the stdin of wlst.sh

It could also be expressed as:

echo "connect('user','pw');
p=redeploy('application');
p.printStatus();
exit();" | /u01/app/oracle/middleware/oracle_common/common/bin/wlst.sh

but without the potential effects of running the command in a subshell.

It could also also be expressed as:

echo "connect('user','pw');
p=redeploy('application');
p.printStatus();
exit();" > someFile
/u01/app/oracle/middleware/oracle_common/common/bin/wlst.sh < someFile
rm someFile
glenn jackman
  • 27,524