Why does this script give me a syntax error running 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
I'm getting this error:
./setup: 1: ./setup: Syntax error: "&" unexpected
/bin/sh
, but|&
,&>
are bash features. – muru Aug 22 '18 at 03:49sudo chmod 777 setup
. I realise this might be off topic to the question but how can i change the permissions so i can edit this?I get the message:
– dos584 Aug 22 '18 at 04:26chmod: changing permissions of 'setup': Read-only file system
bash ./setup
– muru Aug 22 '18 at 05:04#!
line or usebash scriptname.sh
way – Sergiy Kolodyazhnyy Aug 22 '18 at 06:16`Welcome to Altera Software Installer Copyright (c) Altera Corporation 2011
Starting GUI. If nothing shows up, or you don't have an X display, run: ./setup --help for commandline usage. NOTE: All output has been redirected to /tmp/altera_setup.log.ZayF0vZOZi`
Nothing shows up after this is shown, do i need an "X display"?
– dos584 Aug 23 '18 at 06:22/tmp/altera_setup.log.ZayF0vZOZi
one). If you already rebooted,/tmp
will be cleared, so if you don't find that file after reboot, just run the script again, and see what new log file it created – Sergiy Kolodyazhnyy Aug 23 '18 at 06:40setup: line 61: /cdrom/cdrom0/altera_installer/bin/altera_installer_cmd: No such file or directory
. This file and directory definitely exists but the file is locked by root in read only. Doingsudo bash ./setup
returns the same result. Attempts to make it read and write with chmod fail exactly the same as my attempt above with the setup file. – dos584 Aug 23 '18 at 07:17