SED未终止的's'命令仅在少数服务器上失败

时间:2022-07-11 20:12:31

Getting following error:

获得以下错误:

Command:

binary_setup()
{
CRS_VERSION=`${GRID_HOME}/OPatch/opatch lsinventory | ${GREPCMD} "Oracle Database" | tail -1 | ${AWKCMD} '{print $(NF-0)}'`;
}


Error:
Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)

Command:
AWKCMD=`which awk`;
GREPCMD=`which egrep`;
SEDCMD=`which sed`;
CATCMD=`which cat`;
WCCMD=`which wc`;
TRCMD=`which tr`;
SORTCMD=`which sort`;
ECHOCMD=`which echo`;
PRINTFCMD=`which printf`;
COLUMNCMD=`which column`;

${CATCMD} $0 | ${GREPCMD} "HELP:" | ${GREPCMD} -v "GREPCMD" | ${SEDCMD} 's/^.*\crsstat\/\crsstat\/g';


Error:
/bin/sed: -e expression #1, char 255: unterminated `s' command
/bin/sed: -e expression #1, char 0: no previous regular expression

1 个解决方案

#1


You're doing an s/foo/bar search/replace regex, but have no replacement term:

你正在做一个s / foo / bar搜索/替换正则表达式,但没有替换术语:

's/^.*\crsstat\/\crsstat\/g';
  ^--start search pattern
     + no unescaped /, so the pattern never ends

Perhaps

's/^.*\crsstat/\crsstat/g';
              ^--no \--^

instead?

#1


You're doing an s/foo/bar search/replace regex, but have no replacement term:

你正在做一个s / foo / bar搜索/替换正则表达式,但没有替换术语:

's/^.*\crsstat\/\crsstat\/g';
  ^--start search pattern
     + no unescaped /, so the pattern never ends

Perhaps

's/^.*\crsstat/\crsstat/g';
              ^--no \--^

instead?