Anj*_*yna 4 sudo file sh windows-subsystem-for-linux ubuntu-18.04
我有一个名为的 shell 脚本setup_wsl.sh,其中包含:
#!/bin/bash
echo "hai"
sudo apt-get update
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"  
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
当我在 WSL 中将脚本作为 ./setup_wsl.sh 运行时(安装的发行版是 ubuntu 18.04),会出现以下错误:
hai
E: Invalid operation update
E: Unable to locate package
./setup_wsl.sh: 4: ./setup_wsl.sh: apt-transport-https: not found
./setup_wsl.sh: 5: ./setup_wsl.sh: ca-certificates: not found
curl: (3) Illegal characters found in URL
./setup_wsl.sh: 7: ./setup_wsl.sh: gnupg-agent: not found
: not found ./setup_wsl.sh: software-properties-common
: not found ./setup_wsl.sh:
脚本的第一个命令工作正常,因为它给出了输出“hai”。
有人可以帮我找出发生这些错误的原因吗?
| 归档时间: | 
 | 
| 查看次数: | 7511 次 | 
| 最近记录: |