我有一个简单的 shell 脚本,用于更新 Firefox。它的内容是:
#!/bin/sh
sudo apt-get pruge firefox
sudo apt-get install firefox
Run Code Online (Sandbox Code Playgroud)
这就是全部。现在,当我在终端中运行文件时,按顺序使用,
cd Desktop/Batch\ Files
sudo chmod 775 Firefox.sh
sudo ./Firefox.sh
Run Code Online (Sandbox Code Playgroud)
输出表明pruge操作无法完成,但文件的其余部分运行。
这是确切的输出:
sudo: unable to resolve host ubuntu: Connection timed out
E: Invalid operation pruge
sudo: unable to resolve host ubuntu: Connection timed out
Reading package lists... Done
Building dependency tree
Reading state information... Done
firefox is already the newest version (57.0.1+build2-0ubuntu0.16.04.1).
0 upgraded, 0 newly installed, 0 to remove and 261 not upgraded.
Run Code Online (Sandbox Code Playgroud)
尽管很烦人,但我仍然可以逐行运行代码,并且 …