简体   繁体   中英

bash script fails with commands

I have the following script

#!/bin/bash

VERSION=2020-12-R1
LINK_LIBRERIA=https://github.com/greatscottgadgets/ubertooth/archive/refs/tags/$VERSION.tar.gz
LINK_UBERTOOTH=https://github.com/greatscottgadgets/ubertooth/releases/download/$VERSION/ubertooth-$VERSION.tar.xz


LIBRERIA=libbtbb-$VERSION.tar.gz
## Instalacion de las librerias


SUCESS=1
while [ $SUCESS -eq 1 ]
do
  echo "Select Instalation Directory, left EMPTY for use the actual directory"
  read PATH

  if [ -z $PATH ] 

  then
      PATH=$( pwd )
  fi

  cd $PATH
  SUCESS=$?

done

sudo apt-get -y install cmake libusb-1.0-0-dev make gcc g++ libbluetooth-dev \
pkg-config libpcap-dev python-numpy python-pyside python-qt4 -y

# wget $LINK_BASE_LIBRERIA -O $LIBRERIA
# tar xf $LIBRERIA


When I run it it prompts this:

./main.sh: line 29: sudo: command not found

This probles is the same with the commented commands wget and tar

The ugo priviledges are:

$ ls -l
total 12
-rw-rw-r-- 1 k1k4ss0 k1k4ss0 1064 Mar 27 18:21 LICENSE
-rwxrwxrwx 1 k1k4ss0 k1k4ss0  726 Mar 28 12:31 main.sh
-rw-rw-r-- 1 k1k4ss0 k1k4ss0   81 Mar 27 18:21 README.md

I've tried almost all, but i don't known why, I've searched in internet and look for some scripts with similar commands within, but the problem persist.

The problems as said in the comments by @Jetchisel is the PATH variable, the interpreter confuses it with the PATH of the global variable, changing it to lowercase solves the problem

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM