I have a shell script called setup_wsl.sh
which contains:
#!/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
When i run the script as ./setup_wsl.sh in WSL ( installed distro is ubuntu 18.04), errors occur as:
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:
The first command of the script works fine as it gives output "hai".
Can someone help me to find why these errors occured?