.sh 파일을 설치할 수 없습니다.

.sh 파일을 설치할 수 없습니다.

mgl-tools라는 패키지를 사용하려고 하는데 ./install.sh를 실행하면 작동하지 않습니다. 며칠 전에는 작동했었습니다.

오류:

./install.sh 
Installing MGLTools to /home/aka/Desktop/Expt 10/mgltools_x86_64Linux2_1.5.7
Installing Python Interpreter to 
tar (child): /home/aka/Desktop/Expt: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
Error in Python installation

.sh 파일의 내용:

#!/bin/sh

# MGL Tools installation script
pythonargs=" "
pyoptimize=0
TarDir=`pwd`
export MGL_ROOT=""

# Parse the command-line arguments
opts=`getopt "hlc:d:" "$@"`
if [ "$?" != 0 ]
then
   echo "Usage: source install.sh [-d InstDir] [-c optimization]"
   exit
fi
set -- $opts
while :
do
    case "$1" in 

    -c) shift; pythonargs="$pythonargs -c"; pyoptimize="$1";;
    -d) shift; export MGL_ROOT="$1";;
    -l) pythonargs="$pythonargs -l";;
     
    -h) echo "Optional parameters:"
    echo "[-h]  help message;"
    echo "[ -d  InstDir] specifies installation directory (default-current directory)"
    echo "[ -c optimization] compile Python code with or without optimization:"
    echo "    0 - no optimization (generates .pyc files)"
    echo "    1 - with optimization (generates .pyo files);"
    exit ;;
    --) break;;
    esac
    shift
done

if [ "$MGL_ROOT" != "" ]; then
    # check if the user has write access to the installation directory
    if [ -e "$MGL_ROOT" ]; then
    if [ -d "$MGL_ROOT" ]; then
        if [ ! -w  "$MGL_ROOT" ]; then 
        echo "Can not complete installation - specified directory $MGL_ROOT does not have write access."
        exit 1

        fi
    else 
        echo "$MGL_ROOT" is not a directory
        exit 1
    fi
    else 
    echo Creating directory "$MGL_ROOT"
    mkdir "$MGL_ROOT"
    fi

else
    export MGL_ROOT="$(pwd)"
fi

echo "Installing MGLTools to $MGL_ROOT"

cd "$MGL_ROOT"
echo "Installing Python Interpreter to $MLG_ROOT"
tar xzvf $TarDir/Python*.tar.gz

if [ "$?" != 0 ]; then
    echo "Error in Python installation"
    exit 1
fi
echo Python installed, please wait for the rest of MGLTools to be installed 

cd $TarDir

## plaform we run on

export MGL_ARCHOSV=`$TarDir/Tools/archosv`

## add the path to the directory holding the python interpreter to your path

export PATH="$MGL_ROOT/bin:"$PATH

## use Python interpreter locally installed

PYTHON="$MGL_ROOT/bin/python"
export PYTHONHOME="$MGL_ROOT"
if [ "`uname -s`" = "Linux" ] ; then
    export LD_LIBRARY_PATH="$MGL_ROOT/lib"
fi

## run python script - install.py - to install MGL packages and create pmv , adt, and vision scripts

if [ "$pyoptimize" -eq 1 ]; then
    echo "Running $PYTHON -O Tools/install.py $pythonargs"
    $PYTHON -O Tools/install.py $pythonargs
else
    echo "Running $PYTHON Tools/install.py $pythonargs"
    $PYTHON Tools/install.py  $pythonargs
fi

unset PYTHONHOME

답변1

쉘 스크립트는 이름에 공백이 있는 것을 좋아하지 않습니다. 디렉터리 이름을 바꿔보세요.경험치 10공백이 없는 이름으로; 예를 들어,EXPT10그런 다음 다시 시도해 보세요.

편집하다: @cocomac이 올바르게 지적했듯이 올바르게 작성된 스크립트는 이름의 공백을 고려할 수 있고 설명해야 합니다. 그렇지 않은 경우 파일 이름을 바꾸는 것이 편리한 해결책입니다. 스크립트를 다시 작성하고 게시자에게 문제를 제출하는 것도 또 다른 해결책입니다.

관련 정보