linux cp:cannot stat没有这样的文件或目录

col17t5w  于 12个月前  发布在  Linux
关注(0)|答案(2)|浏览(534)

我试图在Ubuntu 16.04 STL(64位)中安装Haptic Device SDK。安装过程很简单。它只是运行sudo ./install,但我遇到了这些问题

COPYING SYSTEM FILES
cp: cannot stat '/home/smsh/Documents/Phantom': No such file or directory
cp: cannot stat 'Omni': No such file or directory
cp: cannot stat 'Drivers/openhaptics_3.4-0-developer-edition-amd64/opt/*': No such file or directory

字符串
安装文件为

#!/bin/bash -e
# Check if user has root privileges or running as root. 

if [ "$EUID" -ne 0 ]
  then echo "Please run as root"
  exit
fi
#Get location of the the script file. 
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
  DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
  SOURCE="$(readlink "$SOURCE")"
  [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

# Print Warning
echo ""
echo -n "THE COMPUTER MUST REBOOT AFTER THE INSTALLATION IN ORDER FOR THE SOFTWARE TO WORK PROPERLY. PLEASE SAVE ANY OPEN FILES OTHERWISE YOU WILL LOSE UNSAVED DATA."
echo ""
echo ""
echo "** Please make sure that you have installed the following dependencies before compiling OpenHaptics applications:"
echo "  - ncurses  (libncurses5-dev)"
echo "  - freeglut (freeglut3)"
echo "  - build-essential"
echo ""
echo ""
while :
do
    echo "The software will be installed to path : /opt/OpenHaptics/Developer/3.4-0/"   
    echo "Do you want to continue? (y/n): "
    read con
    echo ""

    if [ "$con" = "y" -o "$con" = "Y" ]; then
        
        
        #copy files to opt folder
        echo "COPYING SYSTEM FILES"
        
        sudo cp -R $DIR/opt/* /opt
        sudo cp -R $DIR/usr/lib/* /usr/lib
        sudo cp -R $DIR/usr/include/* /usr/include

        #Create symbolic links
        echo ""

        ln -sfn /usr/lib/libHD.so.3.4.0 /usr/lib/libHD.so.3.4
        ln -sfn /usr/lib/libHD.so.3.4.0 /usr/lib/libHD.so

        ln -sfn /usr/lib/libHL.so.3.4.0 /usr/lib/libHL.so.3.4
        ln -sfn /usr/lib/libHL.so.3.4.0 /usr/lib/libHL.so

        ln -sfn /usr/lib/libQH.so.3.4.0 /usr/lib/libQH.so.3.4
        ln -sfn /usr/lib/libQH.so.3.4.0 /usr/lib/libQH.so

        ln -sfn /usr/lib/libQHGLUTWrapper.so.3.4.0 /usr/lib/libQHGLUTWrapper.so.3.4
        ln -sfn /usr/lib/libQHGLUTWrapper.so.3.4.0 /usr/lib/libQHGLUTWrapper.so
        
        sudo chmod -R 777 /opt/OpenHaptics

        echo "DONE!"
        echo ""
        
        #Set path for OH_SDK_BASE

        echo -n "SETTING ENVIRONMENT VARIABLES ..... "
            echo "export OH_SDK_BASE=/opt/OpenHaptics/Developer/3.4-0" > /etc/profile.d/openhaptics.sh

        echo "DONE!"
        echo ""
        echo "IMPORTANT NOTE: The following dependencies are needed to compile OpenHaptics SDK examples. Please make sure they are installed on your system. "
        echo "1. freeglut3-dev"
        echo "2. libncurses5-dev"
        echo "3. zlib1g-dev"

        echo "Please reboot the computer before using Geomagic Touch Device Driver software. "
        echo "Press ANY key to RESTART now or 'q' to cancel" 

        read d

        if [ "$d" = "q" -o "$d" = "Q" ]; then
            echo ""
            echo "Restart aborted."
            echo ""
            echo "Please reboot the computer before using Openhaptics SDK. "
            echo ""
            break
        else
            echo ".... restarting"

            sudo reboot
            
        fi

    elif [ "$con" = "n" -o "$con" = "N" ]; then
        echo "Installation aborted."
        echo ""
        break
    else
        echo "Invalid key."
        echo ""
    fi
done

#install


我安装了以下工具

ncurses  (libncurses5-dev)
freeglut (freeglut3)
build-essential

8oomwypt

8oomwypt1#

移动到名称中没有空格、制表符或换行符的目录。

sudo cp -R $DIR/opt/* /opt

字符串
DIR在空格上分割,应该用引号括起来。

sudo cp -R "$DIR"/opt/* /opt

nkhmeac6

nkhmeac62#

尝试使用bash -c "command"而不是仅使用command

相关问题