#! /bin/bash #============================================================================== # # Copyright (c) 2016,2020,2021 Qualcomm Technologies, Inc. # All Rights Reserved. # Confidential and Proprietary - Qualcomm Technologies, Inc. # #============================================================================== #Dependencies that are needed for sdk running needed_depends=() needed_depends+=('python3-dev') needed_depends+=('wget') needed_depends+=('zip') needed_depends+=('libc++-9-dev') #number of version_depends must match number of needed_depends version_depends=() version_depends+=('Version: 3.6.7-1~18.04') version_depends+=('Version: 1.19.4-1ubuntu2.2') version_depends+=('Version: 3.0-11build1') version_depends+=('Version: 1:9-2~ubuntu18.04.2') #Unmet dependencies need_to_install=() i=0 while [ $i -lt ${#needed_depends[*]} ]; do PKG_INSTALLED=$(dpkg-query -W --showformat='${Status}\n' ${needed_depends[$i]}|grep "install ok installed") echo "Checking for ${needed_depends[$i]}: $PKG_INSTALLED" if [ "$PKG_INSTALLED" == "" ]; then echo "${needed_depends[$i]} is not installed. Adding to list of packages to be installed" need_to_install+=(${needed_depends[$i]}) else current_version=$(dpkg -s ${needed_depends[$i]} | grep Version) if [ "$current_version" == "${version_depends[$i]}" ]; then echo "Success: Version of ${needed_depends[$i]} matches tested version" else echo "WARNING: Version of ${needed_depends[$i]} on this system which is $current_version does not match tested version which is ${version_depends[$i]}" fi fi i=$(( $i +1)); done for j in "${need_to_install[@]}" do sudo apt-get install $j done
时间: 2023-08-23 12:05:43 浏览: 593
作业1参考程序.rar_Linux/Unix编程_LINUX_
这段脚本的目的是检查和安装一些依赖项。根据您提供的内容,我没有看到任何语法错误。但是,如果您遇到了脚本无法执行的问题,可能有几种原因:
1. 权限问题:请确保您对该脚本具有执行权限。您可以使用`chmod +x script.sh`命令为脚本添加执行权限。
2. 缺少解释器:请确保脚本开头的`#! /bin/bash`是正确的解释器路径。如果您的系统上没有Bash解释器,可以尝试将其更改为可用的解释器路径。
3. 缺少依赖项:此脚本依赖于一些软件包,请确保您的系统已安装所需的软件包。如果缺少依赖项,脚本将尝试安装它们。
如果您仍然无法执行脚本,请提供更多关于错误消息或其他上下文的信息,以便我能够更好地帮助您。
阅读全文