我正在尝试修改OSX中的.tcshrc文件,以包含用于安装GNURadio的shell环境变量。但是,它会返回一条错误消息,如此
" -bash:/Users/admin/.tcshrc:第22行:语法错误:意外结束 文件"
修改后的tcshrc文件如下
if (-r /opt/local/bin/port) then
setenv LDFLAGS "-L/opt/local/lib ${LDFLAGS}"
setenv PATH ${HOME}/bin:/opt/local/bin:/opt/local/sbin:${PATH}
setenv MANPATH /opt/local/share/man:${MANPATH}
setenv INFOPATH /opt/local/share/info:${INFOPATH}
setenv PKG_CONFIG_PATH /opt/local/lib/pkgconfig:${PKG_CONFIG_PATH}
endif
# Gnuradio source directory (set up for installing gnuradio in $GR/local/)
setenv GR $HOME/gnuradio
setenv GR_INSTALL ${GR}/local
setenv LDFLAGS "-L${GR_INSTALL}/lib ${LDFLAGS}"
setenv PKG_CONFIG_PATH ${GR_INSTALL}/lib/pkgconfig:${PKG_CONFIG_PATH}
setenv DYLD_LIBRARY_PATH ${GR_INSTALL}/lib:${DYLD_LIBRARY_PATH}
# Set up PYTHON variables
setenv PYTHON_CMD python
setenv PYTHON_VERSION `${PYTHON_CMD} -V |& sed -e 's@\.@ @2' | awk '{ print $2 }'`
setenv PYTHON_ROOT `which ${PYTHON_CMD} | sed -e s@/bin/${PYTHON_CMD}@@g`
setenv PYTHONPATH ${GR_INSTALL}/lib/python${PYTHON_VERSION}/site-packages:${PYTHON_ROOT}/lib/python${PYTHON_VERSION}/site-packages
非常感谢您的帮助
答案 0 :(得分:1)
您希望BASH读取并处理一组针对不同shell的指令! TCSH有一个类似c的编程语言,其中BASH和SH使用一些类似ALGOL-68的模式(我认为)。 Bash根本无法处理你的脚本。
为schript使用正确的shell(tcsh / csh)或将脚本重写为bash语法。
if [ -r /opt/local/bin/port ]
then
export LDFLAGS="-L/opt/local/lib ${LDFLAGS}"
export PATH=${HOME}/bin:/opt/local/bin:/opt/local/sbin:${PATH}
export MANPATH=/opt/local/share/man:${MANPATH}
export INFOPATH=/opt/local/share/info:${INFOPATH}
export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig:${PKG_CONFIG_PATH}
fi
# Gnuradio source directory (set up for installing gnuradio in $GR/local/)
export GR=$HOME/gnuradio
export GR_INSTALL=${GR}/local
export LDFLAGS="-L${GR_INSTALL}/lib ${LDFLAGS}"
export PKG_CONFIG_PATH=${GR_INSTALL}/lib/pkgconfig:${PKG_CONFIG_PATH}
export DYLD_LIBRARY_PATH=${GR_INSTALL}/lib:${DYLD_LIBRARY_PATH}
# Set up PYTHON variables
export PYTHON_CMD=python
export PYTHON_VERSION=`${PYTHON_CMD} -V 2>&1 | sed -e 's@\.@ @2' | awk '{ print $2 }'`
export PYTHON_ROOT=`which ${PYTHON_CMD} | sed -e s@/bin/${PYTHON_CMD}@@g`
export PYTHONPATH=${GR_INSTALL}/lib/python${PYTHON_VERSION}/site-packages:${PYTHON_ROOT}/lib/python${PYTHON_VERSION}/site-packages