Linux under the bizarre script rewrite, solve the script cannot execute

Source: Internet
Author: User

Statement **********************************************

Original works, from the "Blue Blog" blog, Welcome to reprint, please be sure to indicate the source, otherwise hold the copyright legal responsibility.

Please leave a message or email ([email protected]) to indicate the error.

This reprint must be kept here: http://blog.csdn.net/huangyanlong/article/details/39357927

Deep Blue Blog: Http://blog.csdn.net/huangyanlong

***************************************************************************************************

Today, during the installation of the Oracle database, a strange error occurred during the execution of the installation package script, as follows:

[[email protected] test]# sh rpm.sh--word interpretation--ambiguous: ambiguous--redirect: direct: Ambiguous redirect:ambiguous redirect : ambiguous redirect:ambiguous redirect:ambiguous redirect:ambiguous redirect:ambiguous redirect:ambiguous Redirect: Ambiguous redirect:ambiguous redirect:ambiguous redirect:ambiguous redirect:ambiguous redirect:ambiguous redirect:am Biguous redirect:ambiguous redirect:ambiguous redirect:ambiguous redirect:ambiguous redirect:ambiguous Redirect:ambi Guous redirect:ambiguous redirect:ambiguous redirect:ambiguous redirect:ambiguous redirect:ambiguous Redirect:ambigu ous redirect:ambiguous redirect:ambiguous redirect:ambiguous redirect:ambiguous redirect:ambiguous Redirect:ambiguou s redirect:ambiguous redirect:command not Found:command not found:ambiguous redirect:ambiguous redirect:ambiguous re Direct:ambiguous redirect:ambiguous redirect:ambiguous redirect:ambiguous redirect:ambiguous redirect:ambiguous Redi Rect:ambiguous redirect:comMand not Found:command not Found:command not found  

So, we looked at the executed script, which was written in advance to execute the installation package under the win platform, as follows:

[[email protected] test]# cat rpm.sh--View problematic script, no exception written RPM-IVH binutils-2.17.50.0.6-14.el5.x86_64.rpm >> Rpm.log 2>&1rpm-ivh binutils-devel-2.17.50.0.6-14.el5.i386.rpm >> rpm.log 2>&1 RPM-IVH binutils-devel-2.17.50.0.6-14.el5.x86_64.rpm >> rpm.log 2>&1RPM-IVH compat-db-4.2.52-5.1.i386.rpm > > Rpm.log 2>&1rpm-ivh compat-db-4.2.52-5.1.x86_64.rpm >> rpm.log 2>&1RPM-IVH control-center-2.16.0-16.el5.i386.rpm >> rpm.log 2>&1RPM-IVH control-center-2.16.0-16.el5.x86_64.rpm >> rpm.log 2>&1rpm-ivh control-center-devel-2.16.0-16.el5.i386.rpm >> rpm.log 2>&1RPM-IVH control-center-devel-2.16.0-16.el5.x86_64.rpm >> rpm.log 2>&1RPM-IVH gcc-4.1.2-50.el5.x86_64.rpm > > Rpm.log 2>&1rpm-ivh gcc-c++-4.1.2-50.el5.x86_64.rpm >> rpm.log 2>&1RPM-IVH glibc-2.5-58.i686.rpm >> rpm.log 2>&1rpm-ivh glibc-2.5-58.x86_64.rpm >> rpm.log 2>&1RPM-IVH glibc-common-2.5-58.x86_64.rpm >> rpm.log 2>&1rpm-ivh glibc-devel-2.5-58.i386.rpm >> rpm.log 2>&1rpm-ivh glibc-devel-2.5-58.x86_64.rpm >> rpm.log 2>&1RPM-IVH glibc-headers-2.5-58.x86_64.rpm >> rpm.log 2>&1rpm-ivh glibc-utils-2.5-58.x86_64.rpm >> rpm.log 2 >&1RPM-IVH libstdc++-devel-4.1.2-50.el5.i386.rpm >> rpm.log 2>&1rpm-ivh libstdc++- devel-4.1.2-50.el5.x86_64.rpm >> rpm.log 2>&1rpm-ivh libx11-1.0.3-11.el5.i386.rpm >> rpm.log 2> &1RPM-IVH libx11-1.0.3-11.el5.x86_64.rpm >> rpm.log 2>&1rpm-ivh libx11-devel-1.0.3-11.el5.i386.rpm >> rpm.log 2>&1rpm-ivh libx11-devel-1.0.3-11.el5.x86_64.rpm >> rpm.log 2>&1RPM-IVH libxp-1.0.0-8.1.el5.i386.rpm >> rpm.log 2>&1rpm-ivh libxp-1.0.0-8.1.el5.x86_64.rpm >> rpm.log 2 >&1RPM-IVH libxp-devel-1.0.0-8.1.el5.i386.rpm >> rpm.log 2>&1rpm-ivh libxp-devel-1.0.0-8.1.el5.x86_64.rpm >> rpm.log 2>&1rpm-ivh libxpm-3.5.5-3.i386.rpm >> rpm.log 2>& 1RPM-IVH libxpm-3.5.5-3.x86_64.rpm >> rpm.log 2>&1rpm-ivh libxpm-devel-3.5.5-3.i386.rpm >> rpm.log 2>&1RPM-IVH libxpm-devel-3.5.5-3.x86_64.rpm >> rpm.log 2>&1rpm-ivh make-3.81-3.el5.x86_64.rpm >> rpm.log 2>&1rpm-ivh pdksh-5.2.14-36.el5.x86_64.rpm >> rpm.log 2>&1RPM-IVH sysstat-7.0.2-3.el5_5.1.x86_64.rpm >> rpm.log 2>&1RM-RF BINUTILS-2.17.50.0.6-14.EL5.X86_64.RPMRM-RF BINUTILS-DEVEL-2.17.50.0.6-14.EL5.I386.RPMRM-RF BINUTILS-DEVEL-2.17.50.0.6-14.EL5.X86_64.RPMRM-RF COMPAT-DB-4.2.52-5.1.I386.RPMRM-RF COMPAT-DB-4.2.52-5.1.X86_64.RPMRM-RF CONTROL-CENTER-2.16.0-16.EL5.I386.RPMRM- RF CONTROL-CENTER-2.16.0-16.EL5.X86_64.RPMRM-RF CONTROL-CENTER-DEVEL-2.16.0-16.EL5.I386.RPMRM-RF CONTROL-CENTER-DEVEL-2.16.0-16.EL5.X86_64.RPMRM-RF GCC-4.1.2-50.EL5.X86_64.RPMRM-RF Gcc-c++-4.1.2-50.el5.x86_64.RPMRM-RF GLIBC-2.5-58.I686.RPMRM-RF GLIBC-2.5-58.X86_64.RPMRM-RF GLIBC-COMMON-2.5-58.X86_64.RPMRM-RF GLIBC-DEVEL-2.5-58.I386.RPMRM-RF GLIBC-DEVEL-2.5-58.X86_64.RPMRM-RF GLIBC-HEADERS-2.5-58.X86_64.RPMRM-RF GLIBC-UTILS-2.5-58.X86_64.RPMRM-RF LIBSTDC++-DEVEL-4.1.2-50.EL5.I386.RPMRM-RF libstdc++-devel-4.1.2-50.el5.x86_ 64.RPMRM-RF LIBX11-1.0.3-11.EL5.I386.RPMRM-RF LIBX11-1.0.3-11.EL5.X86_64.RPMRM-RF LIBX11-DEVEL-1.0.3-11.EL5.I386.RPMRM-RF LIBX11-DEVEL-1.0.3-11.EL5.X86_64.RPMRM-RF LIBXP-1.0.0-8.1.EL5.I386.RPMRM -RF libxp-1.0.0-8.1.el5.x86_64.rpmrm-rf libxp-devel-1.0.0-8.1.el5.i386.rpmrm-rf libXp-devel-1.0.0-8.1.el5.x86_64. RPMRM-RF LIBXPM-3.5.5-3.I386.RPMRM-RF LIBXPM-3.5.5-3.X86_64.RPMRM-RF LIBXPM-DEVEL-3.5.5-3.I386.RPMRM-RF LIBXPM-DEVEL-3.5.5-3.X86_64.RPMRM-RF MAKE-3.81-3.EL5.X86_64.RPMRM-RF PDKSH-5.2.14-36.EL5.X86_64.RPMRM-RF Sysstat-7.0.2-3.el5_5.1.x86_64.rpmrpm-qa|grep binutils >> queryrpm.log 2>&1rpm-qa|grep compat >> Queryrpm.log 2>&1rpm-qa|grep control >> queryrpm.log 2>&1rpm-qa|grep gcc >> queryrpm.log 2>&1rpm-qa|grep glib C >> queryrpm.log 2>&1rpm-qa|grep gnome >> queryrpm.log 2>&1rpm-qa|grep libstdc++ >> que Ryrpm.log 2>&1rpm-qa|grep make >> queryrpm.log 2>&1rpm-qa|grep pdksh >> queryrpm.log 2>&am P;1rpm-qa|grep sysstat >> Queryrpm.log 2>&1 

The next step is to re-copy the contents of the script to the new file under the Linux platform, as follows:

[[email protected] test]# Cat Hyll.sh--linux system, the instructions in the rpm.sh copied over to the new script file hyll.sh--Re-execute the script content as follows, and the previous rpm.sh script content exactly the same RPM-IVH binutils-2.17.50.0.6-14.el5.x86_64.rpm >> Rpm.log 2>&1RPM-IVH binutils-devel-2.17.50.0.6-14.el5.i386.rpm >> rpm.log 2>&1 RPM-IVH binutils-devel-2.17.50.0.6-14.el5.x86_64.rpm >> rpm.log 2>&1RPM-IVH compat-db-4.2.52-5.1.i386.rpm > > Rpm.log 2>&1rpm-ivh compat-db-4.2.52-5.1.x86_64.rpm >> rpm.log 2>&1RPM-IVH control-center-2.16.0-16.el5.i386.rpm >> rpm.log 2>&1RPM-IVH control-center-2.16.0-16.el5.x86_64.rpm >> rpm.log 2>&1rpm-ivh control-center-devel-2.16.0-16.el5.i386.rpm >> rpm.log 2>&1RPM-IVH control-center-devel-2.16.0-16.el5.x86_64.rpm >> rpm.log 2>&1RPM-IVH gcc-4.1.2-50.el5.x86_64.rpm > > Rpm.log 2>&1rpm-ivh gcc-c++-4.1.2-50.el5.x86_64.rpm >> rpm.log 2>&1RPM-IVH glibc-2.5-58.i686.rpm >> Rpm.log 2>&1RPM-IVH glibc-2.5-58.x86_64.rpm >> rpm.log 2>&1rpm-ivh glibc-common-2.5-58.x86_64.rpm >> rpm.log 2 >&1RPM-IVH glibc-devel-2.5-58.i386.rpm >> rpm.log 2>&1RPM-IVH glibc-devel-2.5-58.x86_64.rpm > > Rpm.log 2>&1rpm-ivh glibc-headers-2.5-58.x86_64.rpm >> rpm.log 2>&1RPM-IVH glibc-utils-2.5-58.x86_64.rpm >> rpm.log 2>&1RPM-IVH libstdc++-devel-4.1.2-50.el5.i386.rpm >> Rpm.log 2>&1rpm-ivh libstdc++-devel-4.1.2-50.el5.x86_64.rpm >> rpm.log 2>&1RPM-IVH libx11-1.0.3-11.el5.i386.rpm >> rpm.log 2>&1rpm-ivh libx11-1.0.3-11.el5.x86_64.rpm >> rpm.log 2 >&1RPM-IVH libx11-devel-1.0.3-11.el5.i386.rpm >> Rpm.log 2>&1RPM-IVH libx11-devel-1.0.3-11.el5.x86_64.rpm >> rpm.log 2>&1RPM-IVH libxp-1.0.0-8.1.el5.i386.rpm >> Rpm.log 2>&1rpm-ivh libxp-1.0.0-8.1.el5.x86_64.rpm >> rpm.log 2>&1RPM-IVH Libxp-devel-1.0.0-8.1.el5.i386. RPM >> rpm.log 2>&1rpm-ivh libxp-devel-1.0.0-8.1.el5.x86_64.rpm >> rpm.log 2>&1RPM-IVH libxpm-3.5.5-3.i386.rpm >> rpm.log 2>&1rpm-ivh libxpm-3.5.5-3.x86_64.rpm >> rpm.log 2>&1rpm -IVH libxpm-devel-3.5.5-3.i386.rpm >> rpm.log 2>&1rpm-ivh libxpm-devel-3.5.5-3.x86_64.rpm >> Rpm.log 2>&1rpm-ivh make-3.81-3.el5.x86_64.rpm >> rpm.log 2>&1rpm-ivh pdksh-5.2.14-36.el5.x86_ 64.rpm >> rpm.log 2>&1rpm-ivh sysstat-7.0.2-3.el5_5.1.x86_64.rpm >> rpm.log 2>&1RM-RF BINUTILS-2.17.50.0.6-14.EL5.X86_64.RPMRM-RF BINUTILS-DEVEL-2.17.50.0.6-14.EL5.I386.RPMRM-RF BINUTILS-DEVEL-2.17.50.0.6-14.EL5.X86_64.RPMRM-RF COMPAT-DB-4.2.52-5.1.I386.RPMRM-RF compat-db-4.2.52-5.1.x86_ 64.RPMRM-RF CONTROL-CENTER-2.16.0-16.EL5.I386.RPMRM-RF CONTROL-CENTER-2.16.0-16.EL5.X86_64.RPMRM-RF CONTROL-CENTER-DEVEL-2.16.0-16.EL5.I386.RPMRM-RF CONTROL-CENTER-DEVEL-2.16.0-16.EL5.X86_64.RPMRM-RF gcc-4.1.2-50.EL5.X86_64.RPMRM-RF GCC-C++-4.1.2-50.EL5.X86_64.RPMRM-RF GLIBC-2.5-58.I686.RPMRM-RF GLIBC-2.5-58.X86_64.RPMRM- RF GLIBC-COMMON-2.5-58.X86_64.RPMRM-RF GLIBC-DEVEL-2.5-58.I386.RPMRM-RF GLIBC-DEVEL-2.5-58.X86_64.RPMRM-RF GLIBC-HEADERS-2.5-58.X86_64.RPMRM-RF GLIBC-UTILS-2.5-58.X86_64.RPMRM-RF LIBSTDC++-DEVEL-4.1.2-50.EL5.I386.RPMRM- RF LIBSTDC++-DEVEL-4.1.2-50.EL5.X86_64.RPMRM-RF LIBX11-1.0.3-11.EL5.I386.RPMRM-RF libX11-1.0.3-11.el5.x86_64. RPMRM-RF LIBX11-DEVEL-1.0.3-11.EL5.I386.RPMRM-RF LIBX11-DEVEL-1.0.3-11.EL5.X86_64.RPMRM-RF LIBXP-1.0.0-8.1.EL5.I386.RPMRM-RF LIBXP-1.0.0-8.1.EL5.X86_64.RPMRM-RF LIBXP-DEVEL-1.0.0-8.1.EL5.I386.RPMRM-RF LIBXP-DEVEL-1.0.0-8.1.EL5.X86_64.RPMRM-RF LIBXPM-3.5.5-3.I386.RPMRM-RF LIBXPM-3.5.5-3.X86_64.RPMRM-RF LIBXPM-DEVEL-3.5.5-3.I386.RPMRM-RF LIBXPM-DEVEL-3.5.5-3.X86_64.RPMRM-RF MAKE-3.81-3.EL5.X86_64.RPMRM-RF PDKSH-5.2.14-36.EL5.X86_64.RPMRM-RF sysstat-7.0.2-3.el5_5.1.x86_64.rpmrpm-qa|grep binutils >> queryrpm.log 2 >&1rpm -qa|grep compat >> queryrpm.log 2>&1rpm-qa|grep control >> queryrpm.log 2>&1rpm-qa|grep GCC & gt;> queryrpm.log 2>&1rpm-qa|grep glibc >> queryrpm.log 2>&1rpm-qa|grep gnome >> queryrpm. Log 2>&1rpm-qa|grep libstdc++ >> queryrpm.log 2>&1rpm-qa|grep make >> queryrpm.log 2>& 1rpm-qa|grep pdksh >> queryrpm.log 2>&1rpm-qa|grep sysstat >> queryrpm.log 2>&1[[email  Protected] test]# sh hyll.sh 

Successful execution, compared to two scripts before and after, there is no difference in writing content.

View script permissions, exactly the same as two scripts, hyll.sh can execute normally, while rpm.sh does not execute properly.

[[email protected] test]# ls-lltotal 24-rw-r--r--1 root root 3855 Sep 1 15:23 hyll.sh-rw-r--r--1 root root 3942 Sep 14:32 rpm.sh

Summary:

Today's problems feel a little strange, almost the same two scripts, one can be executed, the other can not be executed. After another experiment, the script was copied exactly the same time (script name, content), without any modification, the script was rebuilt once. The rebuilt script can be executed. Thought, the only difference is that the script that can't be executed is actually written on WINDOWS , and the new script is actually written on LINUX . Although the problem is solved, this phenomenon still feels very strange.

So with curiosity, in the online search "ambiguous redirect" The cause of the error, found that there are many questions about the redirection format. So think about whether the redirect symbol is required to be written under LINUX to perform normally (that is, the Linux system is more sensitive to some special operators).

With doubt, start experimenting again. The general idea is as follows:

Under Linux , the non-executable script can be modified to execute the script (that is, rewrite the instructions under Linux ), export to WINDOWS , replace the LINUX platform, Rename the exported script file and upload it to the experimental platform to verify the availability of the script. After verification, the script edited by the LINUX platform can execute normally, and the script cannot be executed because of the cross-platform writing format. In WINDOWS and LINUX system in which the format of the swap line is slightly different, so today this error tells us that the future modification of the script to be completed under the LINUX system, and then import into their own storage devices, Case.

Statement **********************************************

Original works, from the "Blue Blog" blog, Welcome to reprint, please be sure to indicate the source, otherwise hold the copyright legal responsibility.

Please leave a message or email ([email protected]) to indicate the error.

This reprint must be kept here: http://blog.csdn.net/huangyanlong/article/details/39357927

Deep Blue Blog: Http://blog.csdn.net/huangyanlong

***************************************************************************************************

Linux under the bizarre script rewrite, solve the script cannot execute

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.