2

I upgraded Ubuntu 16.04 to 18.04. After upgrading, on the login I get the message

Error found when loading /etc/profile. The error is in /usr/share/modules/init/sh file on line 43. The error reads:

/usr/share/modules/init/sh:eval:line 43: syntax error near unexpected token (' /usr/share/modules/init/sh:eval:line 43: untitled(1) _mlshddbg=" ;;'

Base on this "Error found when loading /etc/profile" on login after upgrade I have tried to modify the sh file has recommended but it didn't work

here is the results of

shellcheck /usr/share/modules/init/sh

In /usr/share/modules/init/sh line 1:
unset _mlre _mlIFS _mlshdbg;
^-- SC2148: Tips depend on target shell and yours is unknown. Add a shebang.


In /usr/share/modules/init/sh line 22:
   if [ "${_mlv}" = "${_mlv##*[!A-Za-z0-9_]}" -a "${_mlv}" = "${_mlv#[0-9]}" ]; then
                                              ^-- SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.


In /usr/share/modules/init/sh line 23:
      if [ -n "`eval 'echo ${'$_mlv'+x}'`" ]; then
               ^-- SC2006: Use $(..) instead of legacy `..`.
                              ^-- SC2086: Double quote to prevent globbing and word splitting.


In /usr/share/modules/init/sh line 24:
         _mlre="${_mlre:-}${_mlv}_modquar='`eval 'echo ${'$_mlv'}'`' ";
                                           ^-- SC2006: Use $(..) instead of legacy `..`.
                                                          ^-- SC2086: Double quote to prevent globbing and word splitting.


In /usr/share/modules/init/sh line 27:
      _mlre="${_mlre:-}${_mlv}='`eval 'echo ${'$_mlrv':-}'`' ";
                              ^-- SC2089: Quotes/backslashes will be treated literally. Use an array.
                                ^-- SC2006: Use $(..) instead of legacy `..`.
                                               ^-- SC2086: Double quote to prevent globbing and word splitting.


In /usr/share/modules/init/sh line 36:
eval `${_mlre:-}/usr/bin/tclsh /usr/lib/x86_64-linux-gnu/modulecmd.tcl sh autoinit`
     ^-- SC2046: Quote this to prevent word splitting.
     ^-- SC2006: Use $(..) instead of legacy `..`.
      ^-- SC2090: Quotes/backslashes in this variable will not be respected.
      ^-- SC2086: Double quote to prevent globbing and word splitting.


In /usr/share/modules/init/sh line 50:
      _moduleraw() { eval `/usr/lib/x86_64-linux-gnu/modulecmd-compat sh $*`; }
                          ^-- SC2046: Quote this to prevent word splitting.
                          ^-- SC2006: Use $(..) instead of legacy `..`.
                                                                         ^-- SC2048: Use "$@" (with quotes) to prevent whitespace problems.
                                                                         ^-- SC2086: Double quote to prevent globbing and word splitting.


In /usr/share/modules/init/sh line 52:
      module() { eval `/usr/lib/x86_64-linux-gnu/modulecmd-compat sh $*`; }
                      ^-- SC2046: Quote this to prevent word splitting.
                      ^-- SC2006: Use $(..) instead of legacy `..`.
                                                                     ^-- SC2048: Use "$@" (with quotes) to prevent whitespace problems.
                                                                     ^-- SC2086: Double quote to prevent globbing and word splitting.


In /usr/share/modules/init/sh line 105:
manpath=`manpath 2>/dev/null`
        ^-- SC2006: Use $(..) instead of legacy `..`.

Thank you for your help!

1
  • I also got a similar issue with my /usr/share/modules/init/bash when using command lines
    – Clément
    Feb 8 at 21:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.