14.04 - running simple bash script fails with Syntax error: word unexpected (expecting ")") - Ask Ubuntu


i trying install anaconda3 in ubuntu14.04 this:

seyyedhossein@hossein:~$ sh anaconda3-4.2.0-linux-x86_64.sh  

and :

anaconda3-4.2.0-linux-x86_64.sh: 16: anaconda3-4.2.0-linux-x86_64.sh: 0: not found anaconda3-4.2.0-linux-x86_64.sh: 61: anaconda3-4.2.0-linux-x86_64.sh: 0: not found anaconda3-4.2.0-linux-x86_64.sh: 75: anaconda3-4.2.0-linux-x86_64.sh: syntax error: word unexpected (expecting ")") 

what problem here?
had installed on account (which downloaded from) successfully. when logged in new account, wont run!

update:
output of cat command :

#!/bin/bash # copyright (c) 2012-2016 continuum analytics, inc. # rights reserved. # # name: anaconda3 # version: 4.2.0 # packages: 195 # plat:  linux-64 # descr: 4.1.1-889-g7ce9b7f # bytes: 478051940 # lines: 558 # md5:   1ee1f5cb1d92a230e59cc5fce0dca5ba  unset ld_library_path echo "$0" | grep '\.sh$' >/dev/null if (( $? ));     echo 'please run using "bash" or "sh", not "." or "source"' >&2     return 1 fi  this_dir=$(cd $(dirname $0); pwd) this_file=$(basename $0) this_path="$this_dir/$this_file" prefix=$home/anaconda3 batch=0 force=0  while getopts "bfhp:" x;     case "$x" in         h)             echo "usage: $0 [options]  installs anaconda3 4.2.0      -b           run install in batch mode (without manual intervention),                  expected license terms agreed upon     -f           no error if install prefix exists (force)     -h           print message , exit     -p prefix    install prefix, defaults $prefix "             exit 2             ;;         b)             batch=1             ;;         f)             force=1             ;;         p)             prefix="$optarg"             ;;         ?)             echo "error: did not recognize option, please try -h"             exit 1             ;;     esac done  # verify size of installer wc -c "$this_path" | grep 478051940 >/dev/null if (( $? ));     echo "error: size of $this_file should 478051940 bytes" >&2     exit 1 fi  if [[ $batch == 0 ]] # interactive mode     if [[ `uname -m` != 'x86_64' ]];         echo -n "warning:     operating system appears not 64-bit, trying     install 64-bit version of anaconda3.     sure want continue installation? [yes|no] [no] >>> "         read ans         if [[ ($ans != "yes") && ($ans != "yes") && ($ans != "yes") &&               ($ans != "y") && ($ans != "y") ]] 

the problem script: though claims in own documentation can run sh, i.e. standard posix shell, requires bash.

the construct (( $? )) not valid posix sh, nor ($ans != "yes") when $ans empty. hardly valid in bash either (tbh, first time in 20yrs see idiom (( $? ))) apparently bash lets pass.

solution: run using bash: bash anaconda3-4.2.0-linux-x86_64.sh


Comments

Popular posts from this blog

download - Firefox cannot save files (most of the time), how to solve? - Super User

windows - "-2146893807 NTE_NOT_FOUND" when repair certificate store - Super User