安装脚本语法错误

安装脚本语法错误

为什么这个脚本在运行 ubuntu 18.04 时给出语法错误?

#!/bin/sh

# Copyright (c) 2011 Altera Corporation. All rights reserved.

# Your use of Altera Corporation's design tools, logic functions and other
# software and tools, and its AMPP partner logic functions, and any output files
# any of the foregoing (including device programming or simulation files), and
# any associated documentation or information are expressly subject to the terms
# and conditions of the Altera Program License Subscription Agreement, Altera
# MegaCore Function License Agreement, or other applicable license agreement,
# including, without limitation, that your use is for the sole purpose of
# programming logic devices manufactured by Altera and sold by Altera or its
# authorized distributors.  Please refer to the applicable agreement for
# further details.

script_path=`dirname $0`

if [ -z $script_path ] ;then
    script_path=`which $0 |& tail -1`
fi

if [ $script_path = "." -o $script_path = "" ] ;then
    script_path=`pwd`
fi

if [ ${script_path:0:1} != "/" ] ; then
    script_path=`pwd`/$script_path
fi

export ROOTDIR=$script_path
export CMD_NAME=`basename $0`

if test $CMD_NAME = "setup" ; then
    export CMD_NAME="altera_installer_cmd --source=$ROOTDIR"

    LOG="$(mktemp /tmp/altera_setup.log.XXXXXXXXXX)"

    # no args; default to GUI install based on root directory type
    if [ -z $1 ]; then
        _setup_args="--dvd"
        if [ -f $ROOTDIR/.setup_args ]; then :
            _setup_args=`cat $ROOTDIR/.setup_args`
        fi

        export CMD_NAME="$CMD_NAME $_setup_args"

        echo "Welcome to Altera Software Installer"
        echo "Copyright (c) Altera Corporation 2011"
        echo ""
        echo "Starting GUI. If nothing shows up, or you don't have an X display, run:"
        echo "   ./setup --help "
        echo "for commandline usage."
        echo "NOTE: All output has been redirected to $LOG"
        echo ""
    fi

    export LD_LIBRARY_PATH=$ROOTDIR/altera_installer/bin:$LD_LIBRARY_PATH
    export PATH=$ROOTDIR/altera_installer/bin:$PATH

    if [ -z $1 ]; then
        eval exec "$CMD_NAME $@ &> $LOG"
    else
        eval exec "$CMD_NAME $@"
    fi
elif test $CMD_NAME = "autorun.sh" ; then
    export CMD_NAME="autorun"
    export LD_LIBRARY_PATH=$ROOTDIR/autorun:$LD_LIBRARY_PATH
    export PATH=$ROOTDIR/autorun:$PATH

    LOG="$(mktemp /tmp/altera_dvd_autorun.log.XXXXXXXXXX)"

    eval exec "$CMD_NAME $@ &> $LOG"
fi

我收到此错误: ./setup: 1: ./setup: Syntax error: "&" unexpected

相关内容