QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 758|回复: 1

shell script,请帮忙找错!!

[复制链接]
发表于 2003-12-27 19:17:12 | 显示全部楼层 |阅读模式
[huasen@TheOne huasen]$ sh ./setup
: command not found
./setup: line 78: syntax error near unexpected token `elif'
'/setup: line 78: `  elif [ "$1" = "?" -o "$1" = "-h" -o "$1" = "-help" ]
[huasen@TheOne huasen]$
[code:1]

rundir=`pwd`
fullscrname=$0
# :t
scrname=`echo $fullscrname | awk -F"/" '{ print $NF}'`
# :h
fullscrpath=`echo $fullscrname | awk -F"/" '{ ORS="/"} { n=split($0,A)} { for (i = 1; i < n; i++) print A[i] }'`
if [ "$fullscrpath" = "" ]
then
  fullscrpath=$0
else
  fullscrpath=`echo $fullscrpath | awk '{ n=length($0)} { n -= 1} { print substr($0,1,n)}'`
fi

if [ "$fullscrpath" = "$fullscrname" ]
then
  fullscrpath=`pwd`
else
  cd $fullscrpath
  fullscrpath=`pwd`
fi

echostr=`echo "test \c"`
if [ "$echostr" = "test \c" ]
then
  alt_echo=true
fi

bit_mode_64=false
other_args=""
i=1
while [ "$i" -le $# ]
do
  if [ "$1" = "-display" ]
  then
    shift
    echo "setting DISPLAY to: $1"
    DISPLAY="$1"
    export DISPLAY
    shift
  elif [ "$1" = "?" -o "$1" = "-h" -o "$1" = "-help" ]
  then
    echo ""
    echo "Usage: $scrname [ -display unix:0 ]"
    exit 0
  elif [ "$1" = "-remote" ]
  then
    echo ""
    echo "Sorry, remote installation is not supported in this release."
    exit 1
  elif [ "$1" = "-cdrom" ]
  then
    shift
    echo "setting CDROM path to: $1"
    fullscrpath="$1"
    shift
  elif [ "$1" = "-64" ]
  then
    shift
    bit_mode_64=true
  else
    other_args="$other_args $1"
    shift
  fi
done

cd $rundir
prodir=$fullscrpath
imagedir=$fullscrpath
getpmtscr="getpmt.csh"

if [ ! -x "$imagedir/$getpmtscr" ]
then
  echo ""
  echo "ERROR:  $imagedir/$getpmtscr - file is missing."
  echo "        Check the name of the CD mount directory."
  exit 1
fi

mctype=`$imagedir/$getpmtscr`
if [ "$mctype" = "UNKNOWN" ]
then
  echo ""
  echo "ERROR:  OS name unknown."
  exit 1
fi

test "$TMP"
if [ $? != 0 ]
then
  if [ -x "/tmp" ]
  then
  TMP="/tmp"
  export TMP
  elif [ -x "/var/tmp" ]
  then
  TMP="/var/tmp"
  export TMP
  fi
fi
test "$TEMP"
if [ $? != 0 ]
then
  if [ -x "/tmp" ]
  then
  TEMP="/tmp"
  export TEMP
  elif [ -x "/var/tmp" ]
  then
  TEMP="/var/tmp"
  export TEMP
  fi
fi
test "$DISPLAY"
if [ $? != 0 ]
then
  echo ""
  echo 'ERROR:  The DISPLAY variable is not set - '
  echo ""
  echo "   Options:"
  echo "      o Press <cr> to set DISPLAY to `hostname`:0.0"
  echo "      o Type a value to use for the DISPLAY variable"
  echo "      o Enter 'q' to abort prosetup"
  echo "      o Specify '-display <host>:0' on the command line"
  echo ""
  test "$alt_echo"
  if [ $? = 0 ]
  then
    echo -n "Set it to (`hostname`:0.0): [q to abort] "
  else
    echo "Set it to (`hostname`:0.0): [q to abort] \c"
  fi
  read line
  if [ "$line" = "q*" -o "$line" = "Q*" ]
  then
    exit -1
  elif [ "$line" = "" ]
  then
    DISPLAY="`hostname`:0.0"
    export DISPLAY
  else
    DISPLAY="$line"
    export DISPLAY
  fi
  echo ""
  echo "   DISPLAY has been set to: $DISPLAY"
  echo ""
fi

echo ""
test "$alt_echo"
if [ $? = 0 ]
then
  echo -n "Starting PTC.Setup, please wait ..."
else
  echo "Starting PTC.Setup, please wait ...\c"
fi

if [ "$mctype" = "sun4_solaris_64" -a "$bit_mode_64" = "false" ]
then
  mctype="sun4_solaris"
fi
if [ "$mctype" = "sun4_solaris" ]
then
  PATH=$PATH:/usr/ucb
  export PATH
fi

if [ "$mctype" = "sgi_elf2" -o "$mctype" = "sgi_mips4" ]
then
  PATH=.:$PATH
  export PATH
fi
if [ "$mctype" = "hpux_pa64" -a "$bit_mode_64" = "false" ]
then
  mctype="hpux11_pa32"
fi
if [ "$mctype" = "hpux11_pa32" ]
then
  if [ ! -d "$imagedir/dsrc/$mctype" ]
  then
    mctype="hp8k"
  fi
fi

PTC_CDHOME=$imagedir
export PTC_CDHOME
PS_DIRECTORY=$imagedir/dsrc
export PS_DIRECTORY
DPS_DIRECTORY=$imagedir/dsrc
export DPS_DIRECTORY
PRO_MACHINE_TYPE=$mctype
export PRO_MACHINE_TYPE
LC_NUMERIC=C
export LC_NUMERIC

test "$PROSETUP_EXE"
if [ $? != 0 ]
then
  PROSETUP_EXE="$imagedir/dsrc/$mctype/obj/ptcsetup"
elif [ -x "$PROSETUP_EXE" ]
then
  echo ""
  test "$alt_echo"
  if [ $? = 0 ]
  then
    echo -n "Using $PROSETUP_EXE ..."
  else
    echo "Using $PROSETUP_EXE ...\c"
  fi
fi

if [ ! -x "$PROSETUP_EXE" ]
then
  echo ""
  echo "ERROR:  $PROSETUP_EXE - file is missing."
  echo "        Check the name of the CD mount directory."
  exit 1
fi

REDIRECT_EXE="$imagedir/dsrc/$mctype/obj/redirect"
if [ -x "$REDIRECT_EXE" ]
then
  ($REDIRECT_EXE $other_args -multicd ) &
else
  ($PROSETUP_EXE $other_args ) &
fi

echo ""
exit 0
[/code:1]
 楼主| 发表于 2003-12-27 19:20:46 | 显示全部楼层
[huasen@TheOne huasen]$ sh ./proewildfire
./proewildfire: line 1: setenv: command not found
./proewildfire: line 2: setenv: command not found
: command not founde 3:
: command not founde 4:
: command not founde 6:
'/proewildfire: line 7: syntax error near unexpected token `then
'/proewildfire: line 7: `if ($mc =~ sgi*) then
[code:1]
setenv CV_ENV_HOME $prodir/$mc/CV110
setenv PTC_CVLIB ${CV_ENV_HOME}/usr/apl/cvdors/lib:${CV_ENV_HOME}/usr/apl/cvdors/stubs


# ptc-cmdtype: proe

if ($mc =~ sgi*) then
   unsetenv XUSERFILESEARCHPATH
   setenv GLMGRARRAYOPT 1
endif
if ($mc == ibm_rs6000) then
   setenv PRO_DUMPCATIA_PATH $prodir/$mc/obj
endif
if ($mc == alpha_unix) then
    limit datasize unlimited
    limit stacksize unlimited
endif
if ($mc =~ hp*) then
    setenv _VFORK_NO_CMA true
endif





if ( ! $?CDRS_DATA) then
    setenv CDRS_DATA $prodir
endif
setenv PRO_IMAGE_CONVERTER $prodir/$mc/obj/convert_image
setenv PRO_PHOTORENDER $prodir/$mc/obj/PhotoRender

if (-e $prodir/install/unix/pro_mech_loc.csh) then
    setenv PRO_MECH_COMMAND $0
    source $prodir/install/unix/pro_mech_loc.csh
    if (-e $MECH_LP/install/unix/pro_mech_env.csh) then
        source $MECH_LP/install/unix/pro_mech_env.csh
    endif
endif

setenv GALAXYHOME $prodir/$mc

setenv PRO_COMM_MSG_EXE $prodir/$mc/obj/pro_comm_msg
setenv PROE_START $0
setenv SPG_DIRECTORY $prodir
setenv PRO_USRMAIN $prodir/usrprog/umain/usrmain.c
setenv PROTABLE_DIRECTORY $prodir/protable
setenv PROTAB $prodir/$mc/obj/protab
setenv CLHOME $prodir/text/pcldata
setenv PVIEW_PVEXPORT_HOME $prodir/apps/prodview
setenv VC_VCONF_START $prodir/$mc/obj/ptcvconf
setenv ZIP_EXEC $prodir/$mc/obj/zip
setenv MOZ_PLUGIN_PATH $prodir/$mc/obj/J2RE131/plugin/platform/ns600
setenv PVX_PATH $prodir/xplatform/jar/nodebug

setenv PROE_FEATURE_NAME "PROE_200 ()"


$prodir/$mc/obj/pro $*
exit $status
[/code:1]
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-9-20 12:07 , Processed in 0.045549 second(s), 16 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表