sh: which: line 1: syntax error: unexpected end of file

adadminsrvctl.sh start shows warnings

Symptoms

adadminsrvctl.sh start and adop commands shows warnings after Online Enablement Patching and before applying AD/TXK14 patch during 12.2 upgrade

sh: which: line 1: syntax error: unexpected end of file

sh: error importing function definition for `which’

sh: module: line 1: syntax error: unexpected end of file

sh: error importing function definition for `module’

sh: _module_raw: line 1: syntax error: unexpected end of file

sh: error importing function definition for `_module_raw’

sh: switchml: line 1: syntax error: unexpected end of file

sh: error importing function definition for `switchml’

sh: scl: line 1: syntax error: unexpected end of file

sh: error importing function definition for `scl’

sh: ml: line 1: syntax error: unexpected end of file

sh: error importing function definition for `ml’

/bin/sh: switchml: line 1: syntax error: unexpected end of file

/bin/sh: error importing function definition for `switchml’

/bin/sh: which: line 1: syntax error: unexpected end of file

/bin/sh: error importing function definition for `which’

/bin/sh: ml: line 1: syntax error: unexpected end of file

/bin/sh: error importing function definition for `ml’

/bin/sh: _module_raw: line 1: syntax error: unexpected end of file

/bin/sh: error importing function definition for `_module_raw’

/bin/sh: scl: line 1: syntax error: unexpected end of file

/bin/sh: error importing function definition for `scl’

/bin/sh: module: line 1: syntax error: unexpected end of file

/bin/sh: error importing function definition for `module’

/bin/sh: switchml: line 1: syntax error: unexpected end of file

/bin/sh: error importing function definition for `switchml’

Solution:

These messages should be harmless and is related to a bug on OEL 8. Implement below changes as a workaround for next coommands until few adop cutover cycles for a permanent fix.

As a root user:

cd /etc/profile.d

mv which2.sh which2.shbkp

mv scl-init.sh scl-init.shbkp

mv modules.sh modules.shbkp

As oracle user, execute below unset commands along with the 12.2 environment file

unset -f which

unset -f scl

unset -f ml

unset -f module

unset -f switchml

unset -f _module_raw

Metalink Reference:

R12.2 Errors Running adadminsrvctl.sh with ‘sh: module: line 1: Syntax Error: Unexpected End Of File’ or ‘Importing Function Definition for `BASH_FUNC_module” On Oracle Linux 6 64-bit (Doc ID 1595052.1)

Leave a comment