Answer the question
In order to leave comments, you need to log in
How to apt-get update from a shell script?
sudo apt-get update works fine if run manually, but throws an error when running the script:
sh script.sh
#!/bin/sh
echo "updating"
sudo apt-get update
updating
E: Invalid operation update
Answer the question
In order to leave comments, you need to log in
most likely the script is saved in some Windows notepad, which has a line break \r\n
If so, then it sed -i 's/\r//' script.sh
will help
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question